graphql-engine/server/src-lib/Hasura/RQL/DDL/Deps.hs

24 lines
635 B
Haskell
Raw Normal View History

2018-06-27 16:11:32 +03:00
module Hasura.RQL.DDL.Deps
( reportDeps,
reportDepsExt,
)
where
2018-06-27 16:11:32 +03:00
import Data.Text.Extended
import Hasura.Base.Error
import Hasura.Prelude
import Hasura.RQL.Types
2018-06-27 16:11:32 +03:00
reportDeps :: (QErrM m) => [SchemaObjId] -> m ()
reportDeps deps =
throw400 DependencyError $
"cannot drop due to the following dependent objects : "
<> reportSchemaObjs deps
2018-06-27 16:11:32 +03:00
reportDepsExt :: (QErrM m) => [SchemaObjId] -> [Text] -> m ()
2018-06-27 16:11:32 +03:00
reportDepsExt deps unknownDeps =
throw400 DependencyError $
"cannot drop due to the following dependent objects : " <> depObjsTxt
where
depObjsTxt = commaSeparated $ reportSchemaObjs deps : unknownDeps