module Model.ServerExceptions where import Control.Exception data QueryException = SyntaxException | VariableException | ParseFragmentException | EmptyQueryException | InvalidObjectException | InvalidScalarException | InvalidObjectNestedObjectFieldException | InvalidObjectScalarFieldException | InvalidObjectSubFieldException | InvalidAttributeTransformation | NullArgumentException | CreatingSqlQueryObjectFieldsException | CreatingSqlQueryObjectsException | TooManyTablesException | EmptyRowException | EOFDataProcessingException | InvalidArgumentException | Foundlinebreakexception | RelationshipConfigurationException deriving Show instance Exception QueryException -- use Control.Exception.assert to make your unit tests. -- simply use throw SyntaxException -- can I catch from main block? -- you can catch an exception and display message at next page. -- TODO: abstract read ServerObject: if read is wrong we catch and throw read server object error