-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | Wrapper around errors from sqlite-simple -- -- Wrapper around errors from sqlite-simple. Get easy-to-pattern-match -- data types for constraint errors. @package sqlite-simple-errors @version 0.5.0.0 module Database.SQLite.SimpleErrors.Types -- | Constraint represents the kind of constraint violation returned by -- SQLite. data Constraint NotNull :: Constraint ForeignKey :: Constraint Unique :: Constraint Check :: Constraint -- | SQLiteResponse is a wrapper around the different kinds of errors that -- can be returned frm sqlite-simple. If there is a constraint error, -- then we will construnct a SQLConstraintError instance. data SQLiteResponse SQLConstraintError :: Constraint -> Text -> SQLiteResponse SQLFormatError :: FormatError -> SQLiteResponse SQLResultError :: ResultError -> SQLiteResponse SQLOtherError :: SQLError -> SQLiteResponse instance GHC.Classes.Eq Database.SQLite.SimpleErrors.Types.SQLiteResponse instance GHC.Show.Show Database.SQLite.SimpleErrors.Types.SQLiteResponse instance GHC.Classes.Eq Database.SQLite.SimpleErrors.Types.Constraint instance GHC.Show.Show Database.SQLite.SimpleErrors.Types.Constraint instance GHC.Exception.Exception Database.SQLite.SimpleErrors.Types.SQLiteResponse module Database.SQLite.SimpleErrors.Parser -- | Given a SQL error, converts it into a SQLiteResponse. If the error is -- not an ErrorConstraint, it is essentially just wrapped in -- SQLOtherError. If the error is an ErrorConstraint error, try to parse -- the error as one of the following kinds of constraint violations: -- Foreign Key, Not Null, Unique, or Check. receiveSQLError :: SQLError -> SQLiteResponse module Database.SQLite.SimpleErrors -- | Type synonym for what is returned by runDBAction. Either a -- SQLiteResponse or another type. type DatabaseResponse a = Either SQLiteResponse a -- | runDBAction accepts an IO action to perform some database logic using -- sqlite-simple. We capture any errors that are returned and wrap them -- in our SQLiteResponse type. If any other type of exception is raised, -- it is rethrown. runDBAction :: IO a -> IO (DatabaseResponse a)