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.Except (MonadError(throwError))
20 import Gargantext.Prelude
22 ------------------------------------------------------------------------
23 data TreeError = NoRoot
27 instance Show TreeError
29 show NoRoot = "Root node not found"
30 show EmptyRoot = "Root node should not be empty"
31 show TooManyRoots = "Too many root nodes"
33 class HasTreeError e where
34 _TreeError :: Prism' e TreeError
36 treeError :: ( MonadError e m
40 treeError te = throwError $ _TreeError # te