{- |
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 SchemaException = ReadSchemaFileException
                     | SchemaDuplicateServerObjectException
                     | SchemaDuplicateInterfaceException
                     | ReadJsonObjectsException
                     | ReadServerNameStringException
                     | ReadScalarFieldException
                     | ReadDatabaseTableException
                     | ReadJsonStringException
                     | ReadPseudonymsException
                     | ReadInterfaceInstancesException
                     | ReadDatabaseIdsException
                     | ReadJsonStringListException
                     | ReadDatabaseRelationshipsException
                     | ScalarFieldDataTypeException
                     | ReadDatabaseRelationshipsCardinalityException
                     | PrimaryObjectNotFoundException
                     | SchemaDuplicateException
                     | InterfaceScalarTypesException
  deriving Show
instance Exception SchemaException

data VariableException = MissingVariableValueException
                       | ReadVariablesJsonException
                       | VariablesSyntaxException
                       | InvalidVariableTypeException
  deriving Show
instance Exception VariableException

data QueryException = ParseFragmentException
                    | EmptyQueryException
                    | InvalidObjectException
                    | FindFragmentException
                    | ReadDirectiveException
                    | MismatchedVariableTypeException
                    | InvalidVariableNameException
                    | InvalidScalarException
                    | TransformationSyntaxException
                    | DuplicateObjectsException
                    | ReadJsonException
                    | QuerySyntaxException
  deriving Show
instance Exception QueryException

data ReferenceException = RelationshipCardinalityException
                        | RelationshipLinkageIdException
                        | UnrecognisedObjectException
                        | UnrecognisedArgumentException
                        | UnrecognisedOptionException
                        | DisagreeingObjectFieldsException
                        | UnrecognisedScalarException
                        | UnrecognisedRelationshipException
                        | InvalidPropertiesException
  deriving Show
instance Exception ReferenceException