@@ -26,6 +26,7 @@ module Database.PostgreSQL.Simple.Result
27 Result(..)
27 Result(..)
28 , ResultError(..)
28 , ResultError(..)
31#include "MachDeps.h"
32#include "MachDeps.h"
@@ -250,9 +251,13 @@ doConvert f types cvt (Just bs)
250doConvert f _ _ _ = returnError UnexpectedNull f ""
251doConvert f _ _ _ = returnError UnexpectedNull f ""
254+-- | Given one of the constructors from 'ResultError', the field,
255+-- and an 'errMessage', this fills in the other fields in the
256+-- exception value and returns it in a 'Left . SomeException'
253returnError :: forall a err . (Typeable a, Exception err)
258returnError :: forall a err . (Typeable a, Exception err)
254 => (String -> String -> String -> err)
259 => (String -> String -> String -> err)
255− -> Field -> String -> Status a
260+ -> Field -> String -> Either SomeException a
256returnError mkErr f = left . mkErr (B.unpack (typename f))
261returnError mkErr f = left . mkErr (B.unpack (typename f))
257 (show (typeOf (undefined :: a)))
262 (show (typeOf (undefined :: a)))