2 Module : Gargantext.Database.Tree.Error
4 Copyright : (c) CNRS, 2017-Present
5 License : AGPL + CECILL v3
6 Maintainer : team@gargantext.org
7 Stability : experimental
12 {-# LANGUAGE QuasiQuotes #-}
14 module Gargantext.Database.Query.Tree.Error
17 import Control.Lens (Prism', (#))
18 import Control.Monad.Error.Class (MonadError(throwError))
19 import Gargantext.Prelude
21 ------------------------------------------------------------------------
22 data TreeError = NoRoot
26 instance Show TreeError
28 show NoRoot = "Root node not found"
29 show EmptyRoot = "Root node should not be empty"
30 show TooManyRoots = "Too many root nodes"
32 class HasTreeError e where
33 _TreeError :: Prism' e TreeError
35 treeError :: ( MonadError e m
39 treeError te = throwError $ _TreeError # te