I would like to know how I can catch an exception if raised by the following piece of code
query_3 <- quickQuery' conn_1 "SELECT MAX(high) \
                              FROM historicalData " []                                    
mapM_ (putStrLn . convertSqlValToString) query_3   
I got to know that it's possible with something called "catchSql" , but have no idea how to use it in the above code
 
                        
I can't test it now, but try something like:
It uses
(which is just
catchSql :: IO a -> (SqlError -> IO a) -> IO awith its arguments reversed).Function
handleSqlruns the action given as its second argument, in your casequickQuery'followed bymapM_. And if aSqlErroroccurs during that part, it passes it to the function given as the first argument. So in the above example, if aSqlErroroccurs during the inner block,handleSqlwill callprinton it..