mirror of
https://github.com/Start9Labs/registry.git
synced 2026-04-01 20:44:15 +00:00
organization refactor separating database actions, data transformations, and api type constructs into separate components
This commit is contained in:
committed by
Keagan McClelland
parent
fe5218925d
commit
649f876692
@@ -8,7 +8,6 @@ import Startlude
|
||||
import Data.String.Interpolate.IsString
|
||||
import Network.HTTP.Types
|
||||
import Yesod.Core
|
||||
import qualified Data.Text as T
|
||||
|
||||
type S9ErrT m = ExceptT S9Error m
|
||||
|
||||
@@ -18,7 +17,6 @@ data S9Error =
|
||||
| NotFoundE Text
|
||||
| InvalidParamsE Text Text
|
||||
| AssetParseE Text Text
|
||||
| DepMetadataE [Text]
|
||||
deriving (Show, Eq)
|
||||
|
||||
instance Exception S9Error
|
||||
@@ -31,9 +29,6 @@ toError = \case
|
||||
NotFoundE e -> Error NOT_FOUND [i|#{e}|]
|
||||
InvalidParamsE e m -> Error INVALID_PARAMS [i|Could not parse request parameters #{e}: #{m}|]
|
||||
AssetParseE asset found -> Error PARSE_ERROR [i|Could not parse #{asset}: #{found}|]
|
||||
DepMetadataE errs -> do
|
||||
let errorText = T.concat errs
|
||||
Error NOT_FOUND [i|#{errorText}|]
|
||||
|
||||
data ErrorCode =
|
||||
DATABASE_ERROR
|
||||
@@ -69,4 +64,3 @@ toStatus = \case
|
||||
NotFoundE _ -> status404
|
||||
InvalidParamsE _ _ -> status400
|
||||
AssetParseE _ _ -> status500
|
||||
DepMetadataE _ -> status404
|
||||
|
||||
Reference in New Issue
Block a user