{- | Module : Model.ServerExceptions Description : Here are exceptions for debugging. License : IPS Maintainer : jasonsychau@live.ca Stability : provisional -} 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 | FailedObjectEqualityException | DuplicateRootObjectsException | ImportSchemaException | ImportSchemaServerNameException | ImportSchemaPseudonymsException | ImportSchemaScalarFieldsException | ImportSchemaObjectFieldsException | ImportSchemaDatabaseTablesException | ImportSchemaDatabaseRelationshipsException | ImportSchemaChildrenException | MissingVariableValueException | InvalidVariableNameException | MismatchedVariableTypeException | InvalidVariableTypeException | ReadVariablesException | VariablesSyntaxException | ValueInterpretationException | InvalidDirectiveException deriving Show -- InvalidObjectNestedObjectFieldException | -- InvalidObjectScalarFieldException | -- InvalidAttributeTransformation | -- CreatingSqlQueryObjectsException | -- TooManyTablesException | -- EmptyRowException | -- Foundlinebreakexception | 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