Skip to content

Commit

Permalink
backend/fix :#38 added sos not found error
Browse files Browse the repository at this point in the history
  • Loading branch information
soumyajit2304 committed Mar 9, 2023
1 parent 671e764 commit 765be18
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 4 deletions.
8 changes: 4 additions & 4 deletions lib/mobility-core/mobility-core.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,7 @@ library
, cryptonite
, data-default-class
, deriving-aeson
, dhall
, dhall <=1.35.0
, double-conversion
, either
, esqueleto
Expand Down Expand Up @@ -339,7 +339,7 @@ library
, time
, tinylog
, transformers
, universum
, universum <1.8
, unix
, unliftio
, unliftio-core
Expand Down Expand Up @@ -417,7 +417,7 @@ test-suite mobility-core-tests
, cryptonite
, data-default-class
, deriving-aeson
, dhall
, dhall <=1.35.0
, double-conversion
, either
, esqueleto
Expand Down Expand Up @@ -481,7 +481,7 @@ test-suite mobility-core-tests
, time
, tinylog
, transformers
, universum
, universum <1.8
, unix
, unliftio
, unliftio-core
Expand Down
16 changes: 16 additions & 0 deletions lib/mobility-core/src/Kernel/Types/Error.hs
Original file line number Diff line number Diff line change
Expand Up @@ -868,6 +868,7 @@ instance IsHTTPError MMIError where

instance IsAPIError MMIError


data MerchantMessageError
= MerchantMessageNotFound Text Text
deriving (Eq, Show, IsBecknAPIError)
Expand All @@ -885,3 +886,18 @@ instance IsHTTPError MerchantMessageError where
MerchantMessageNotFound _ _ -> E500

instance IsAPIError MerchantMessageError

newtype SosError = SosIdDoesNotExist Text
deriving (Eq, Show, IsBecknAPIError)

instanceExceptionWithParent 'HTTPException ''SosError

instance IsBaseError SosError where
toMessage (SosIdDoesNotExist sosId) = Just $ "Sos with sosId \"" <> show sosId <> "\" not found. "

instance IsHTTPError SosError where
toErrorCode _ = "SOS_ID_DOES_NOT_EXITS"
toHttpCode _ = E400

instance IsAPIError SosError

0 comments on commit 765be18

Please sign in to comment.