graphql-engine-1.0.0: GraphQL API over Postgres
Safe HaskellSafe-Inferred
LanguageHaskell2010

Hasura.Backends.MSSQL.SQL.Error

Description

Functions and datatypes for interpreting MSSQL database errors.

Synopsis

Documentation

data ErrorClass Source #

The top-level error class. Errors in MSSQL are divided into different classes, which are further subdivided into individual error subclasses. It is useful to determine the class of database exception and handle it appropriately.

Instances

Instances details
Show ErrorClass Source # 
Instance details

Defined in Hasura.Backends.MSSQL.SQL.Error

Eq ErrorClass Source # 
Instance details

Defined in Hasura.Backends.MSSQL.SQL.Error

data ErrorSubclass a Source #

Constructors

NoSubclass

represents non-specific 000 subclass code

Subclass a

represents known, more specific sub class

Instances

Instances details
Eq a => Eq (ErrorSubclass a) Source # 
Instance details

Defined in Hasura.Backends.MSSQL.SQL.Error

parseErrorClass :: String -> Maybe ErrorClass Source #

Parsing error class and subclass information from a SQLSTATE code. SQLSTATE provides detailed information about the cause of a warning or error. A SQLSTATE consists of 5 chars. They are divided into two parts: the first and second chars contain a class and the following three a subclass.

defaultMSSQLTxErrorHandler :: MSSQLTxError -> QErr Source #

A default transaction error handler where all errors are unexpected.

mutationMSSQLTxErrorHandler :: MSSQLTxError -> QErr Source #

A transaction error handler to be used in constructing mutation transactions, i.e INSERT, UPDATE and DELETE. We expect data exception and integrity constraint violation.

mkMSSQLTxErrorHandler :: (ErrorClass -> Bool) -> MSSQLTxError -> QErr Source #

Constructs a transaction error handler given a predicate that determines which error classes (and subclasses) are expected and should be reported to the user. All other errors are considered internal errors. Example:- Consider a insert mutation where we insert some data into columns of a table. Except for the basic data type, such as Boolean, String, Float, Int etc. we cannot invalidate data any further, such as validating timestamp string format. In this case, a @DataException is expected from the database and it is handled and thrown with proper error message.