| Copyright | (c) Eitan Chatav 2019 |
|---|---|
| Maintainer | eitan@morphism.tech |
| Stability | experimental |
| Safe Haskell | None |
| Language | Haskell2010 |
Squeal.PostgreSQL.Session.Exception
Description
exceptions
Synopsis
- data SquealException
- pattern UniqueViolation :: ByteString -> SquealException
- pattern CheckViolation :: ByteString -> SquealException
- pattern SerializationFailure :: ByteString -> SquealException
- data SQLState = SQLState {}
- data ExecStatus
- catchSqueal :: MonadUnliftIO io => io a -> (SquealException -> io a) -> io a
- handleSqueal :: MonadUnliftIO io => (SquealException -> io a) -> io a -> io a
- trySqueal :: MonadUnliftIO io => io a -> io (Either SquealException a)
- throwSqueal :: MonadUnliftIO io => SquealException -> io a
Documentation
data SquealException Source #
Exceptions that can be thrown by Squeal.
Constructors
| SQLException SQLState | SQL exception state |
| ConnectionException Text |
|
| DecodingException Text Text | decoding exception function and error message |
| ColumnsException Text Column | unexpected number of columns |
| RowsException Text Row Row | too few rows, expected at least and actual number of rows |
Instances
| Eq SquealException Source # | |
Defined in Squeal.PostgreSQL.Session.Exception Methods (==) :: SquealException -> SquealException -> Bool # (/=) :: SquealException -> SquealException -> Bool # | |
| Show SquealException Source # | |
Defined in Squeal.PostgreSQL.Session.Exception Methods showsPrec :: Int -> SquealException -> ShowS # show :: SquealException -> String # showList :: [SquealException] -> ShowS # | |
| Exception SquealException Source # | |
Defined in Squeal.PostgreSQL.Session.Exception Methods toException :: SquealException -> SomeException # | |
pattern UniqueViolation :: ByteString -> SquealException Source #
A pattern for unique violation exceptions.
pattern CheckViolation :: ByteString -> SquealException Source #
A pattern for check constraint violation exceptions.
pattern SerializationFailure :: ByteString -> SquealException Source #
A pattern for serialization failure exceptions.
data ExecStatus #
Constructors
| EmptyQuery | The string sent to the server was empty. |
| CommandOk | Successful completion of a command returning no data. |
| TuplesOk | Successful completion of a command returning data (such as a SELECT or SHOW). |
| CopyOut | Copy Out (from server) data transfer started. |
| CopyIn | Copy In (to server) data transfer started. |
| CopyBoth | Copy In/Out data transfer started. |
| BadResponse | The server's response was not understood. |
| NonfatalError | A nonfatal error (a notice or warning) occurred. |
| FatalError | A fatal error occurred. |
| SingleTuple | The PGresult contains a single result tuple from the current command. This status occurs only when single-row mode has been selected for the query. |
Instances
| Enum ExecStatus | |
Defined in Database.PostgreSQL.LibPQ Methods succ :: ExecStatus -> ExecStatus # pred :: ExecStatus -> ExecStatus # toEnum :: Int -> ExecStatus # fromEnum :: ExecStatus -> Int # enumFrom :: ExecStatus -> [ExecStatus] # enumFromThen :: ExecStatus -> ExecStatus -> [ExecStatus] # enumFromTo :: ExecStatus -> ExecStatus -> [ExecStatus] # enumFromThenTo :: ExecStatus -> ExecStatus -> ExecStatus -> [ExecStatus] # | |
| Eq ExecStatus | |
Defined in Database.PostgreSQL.LibPQ | |
| Show ExecStatus | |
Defined in Database.PostgreSQL.LibPQ Methods showsPrec :: Int -> ExecStatus -> ShowS # show :: ExecStatus -> String # showList :: [ExecStatus] -> ShowS # | |
Arguments
| :: MonadUnliftIO io | |
| => io a | |
| -> (SquealException -> io a) | handler |
| -> io a |
Catch SquealExceptions.
Arguments
| :: MonadUnliftIO io | |
| => (SquealException -> io a) | handler |
| -> io a | |
| -> io a |
Handle SquealExceptions.
trySqueal :: MonadUnliftIO io => io a -> io (Either SquealException a) Source #
Either return a SquealException or a result.
throwSqueal :: MonadUnliftIO io => SquealException -> io a Source #
Throw SquealExceptions.