Copyright | (c) CNRS 2017-Present |
---|---|
License | AGPL + CECILL v3 |
Maintainer | team@gargantext.org |
Stability | experimental |
Portability | POSIX |
Safe Haskell | Safe-Inferred |
Language | Haskell2010 |
Synopsis
- data FrontendError where
- FrontendError :: forall b. IsFrontendErrorData b => {..} -> FrontendError
- data BackendErrorCode
- = EC_404__node_list_not_found
- | EC_404__node_root_not_found
- | EC_404__node_lookup_failed_not_found
- | EC_404__node_lookup_failed_parent_not_found
- | EC_400__node_lookup_failed_user_too_many_roots
- | EC_404__node_lookup_failed_user_not_found
- | EC_404__node_lookup_failed_username_not_found
- | EC_404__node_corpus_not_found
- | EC_500__node_not_implemented_yet
- | EC_404__node_context_not_found
- | EC_400__node_creation_failed_no_parent
- | EC_400__node_creation_failed_parent_exists
- | EC_400__node_creation_failed_insert_node
- | EC_400__node_creation_failed_user_negative_id
- | EC_500__node_generic_exception
- | EC_400__node_needs_configuration
- | EC_400__validation_error
- | EC_403__login_failed_error
- | EC_403__login_failed_invalid_username_or_password
- | EC_403__user_not_authorized
- | EC_404__tree_root_not_found
- | EC_404__tree_empty_root
- | EC_500__tree_too_many_roots
- | EC_500__internal_server_error
- | EC_405__not_allowed
- | EC_500__job_invalid_id_type
- | EC_500__job_expired
- | EC_500__job_invalid_mac
- | EC_500__job_unknown_job
- | EC_500__job_generic_exception
- data BackendInternalError
- newtype GraphQLError = GraphQLError FrontendError
- data family ToFrontendErrorData (payload :: BackendErrorCode) :: Type
- mkFrontendErrNoDiagnostic :: IsFrontendErrorData payload => ToFrontendErrorData payload -> FrontendError
- mkFrontendErrShow :: IsFrontendErrorData payload => ToFrontendErrorData payload -> FrontendError
- mkFrontendErr' :: forall payload. IsFrontendErrorData payload => Text -> ToFrontendErrorData (payload :: BackendErrorCode) -> FrontendError
- data Dict (c :: k -> Constraint) (a :: k) where
- class (SingI payload, ToJSON (ToFrontendErrorData payload), FromJSON (ToFrontendErrorData payload), Show (ToFrontendErrorData payload), Eq (ToFrontendErrorData payload), Typeable payload) => IsFrontendErrorData payload where
- isFrontendErrorData :: Proxy payload -> Dict IsFrontendErrorData payload
- genFrontendErr :: BackendErrorCode -> Gen FrontendError
The main frontend error type
data FrontendError where #
An error that can be returned to the frontend. It carries a human-friendly diagnostic, the 'type' of the error as well as some context-specific data.
FrontendError | |
|
Instances
FromJSON FrontendError # | |
Defined in Gargantext.API.Errors.Types parseJSON :: Value -> Parser FrontendError # parseJSONList :: Value -> Parser [FrontendError] # | |
ToJSON FrontendError # | |
Defined in Gargantext.API.Errors.Types toJSON :: FrontendError -> Value # toEncoding :: FrontendError -> Encoding # toJSONList :: [FrontendError] -> Value # toEncodingList :: [FrontendError] -> Encoding # | |
Show FrontendError # | |
Defined in Gargantext.API.Errors.Types showsPrec :: Int -> FrontendError -> ShowS # show :: FrontendError -> String # showList :: [FrontendError] -> ShowS # | |
Eq FrontendError # | |
Defined in Gargantext.API.Errors.Types (==) :: FrontendError -> FrontendError -> Bool # (/=) :: FrontendError -> FrontendError -> Bool # |
The internal backend type and an enumeration of all possible backend error types
data BackendErrorCode #
A (hopefully and eventually) exhaustive list of backend errors.
Instances
data BackendInternalError #
An internal error which can be emitted from the backend and later
converted into a FrontendError
, for later consumption.
Instances
newtype GraphQLError #
Instances
FromJSON GraphQLError # | |
Defined in Gargantext.API.Errors.Types parseJSON :: Value -> Parser GraphQLError # parseJSONList :: Value -> Parser [GraphQLError] # | |
ToJSON GraphQLError # | |
Defined in Gargantext.API.Errors.Types toJSON :: GraphQLError -> Value # toEncoding :: GraphQLError -> Encoding # toJSONList :: [GraphQLError] -> Value # toEncodingList :: [GraphQLError] -> Encoding # | |
Show GraphQLError # | |
Defined in Gargantext.API.Errors.Types showsPrec :: Int -> GraphQLError -> ShowS # show :: GraphQLError -> String # showList :: [GraphQLError] -> ShowS # | |
Eq GraphQLError # | |
Defined in Gargantext.API.Errors.Types (==) :: GraphQLError -> GraphQLError -> Bool # (/=) :: GraphQLError -> GraphQLError -> Bool # |
data family ToFrontendErrorData (payload :: BackendErrorCode) :: Type #
Instances
Constructing frontend errors
mkFrontendErrNoDiagnostic :: IsFrontendErrorData payload => ToFrontendErrorData payload -> FrontendError #
Creates an error without attaching a diagnostic to it.
mkFrontendErrShow :: IsFrontendErrorData payload => ToFrontendErrorData payload -> FrontendError #
Renders the error by using as a diagnostic the string
resulting from Show
ing the underlying type.
mkFrontendErr' :: forall payload. IsFrontendErrorData payload => Text -> ToFrontendErrorData (payload :: BackendErrorCode) -> FrontendError #
Evidence carrying
data Dict (c :: k -> Constraint) (a :: k) where #
class (SingI payload, ToJSON (ToFrontendErrorData payload), FromJSON (ToFrontendErrorData payload), Show (ToFrontendErrorData payload), Eq (ToFrontendErrorData payload), Typeable payload) => IsFrontendErrorData payload where #
isFrontendErrorData :: Proxy payload -> Dict IsFrontendErrorData payload #