| 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
- pattern DeadlockDetected :: ByteString -> SquealException
- data SQLState = SQLState {}
- data ExecStatus
- catchSqueal :: MonadCatch m => m a -> (SquealException -> m a) -> m a
- handleSqueal :: MonadCatch m => (SquealException -> m a) -> m a -> m a
- trySqueal :: MonadCatch m => m a -> m (Either SquealException a)
- throwSqueal :: MonadThrow m => SquealException -> m 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.
pattern DeadlockDetected :: ByteString -> SquealException Source #
A pattern for deadlock detection 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
| :: MonadCatch m | |
| => m a | |
| -> (SquealException -> m a) | handler |
| -> m a |
Catch SquealExceptions.
Arguments
| :: MonadCatch m | |
| => (SquealException -> m a) | handler |
| -> m a | |
| -> m a |
Handle SquealExceptions.
trySqueal :: MonadCatch m => m a -> m (Either SquealException a) Source #
Either return a SquealException or a result.
throwSqueal :: MonadThrow m => SquealException -> m a Source #
Throw SquealExceptions.