module Aws.Lambda.Runtime.Error
( EnvironmentVariableNotSet (..),
Parsing (..),
Invocation (..),
)
where
import Control.Exception.Safe.Checked (Exception)
import Data.Aeson (ToJSON (..), object, (.=))
import qualified Data.ByteString.Lazy as LBS
import Data.Text (Text)
newtype EnvironmentVariableNotSet
= EnvironmentVariableNotSet Text
deriving (Int -> EnvironmentVariableNotSet -> ShowS
[EnvironmentVariableNotSet] -> ShowS
EnvironmentVariableNotSet -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [EnvironmentVariableNotSet] -> ShowS
$cshowList :: [EnvironmentVariableNotSet] -> ShowS
show :: EnvironmentVariableNotSet -> String
$cshow :: EnvironmentVariableNotSet -> String
showsPrec :: Int -> EnvironmentVariableNotSet -> ShowS
$cshowsPrec :: Int -> EnvironmentVariableNotSet -> ShowS
Show, Show EnvironmentVariableNotSet
Typeable EnvironmentVariableNotSet
SomeException -> Maybe EnvironmentVariableNotSet
EnvironmentVariableNotSet -> String
EnvironmentVariableNotSet -> SomeException
forall e.
Typeable e
-> Show e
-> (e -> SomeException)
-> (SomeException -> Maybe e)
-> (e -> String)
-> Exception e
displayException :: EnvironmentVariableNotSet -> String
$cdisplayException :: EnvironmentVariableNotSet -> String
fromException :: SomeException -> Maybe EnvironmentVariableNotSet
$cfromException :: SomeException -> Maybe EnvironmentVariableNotSet
toException :: EnvironmentVariableNotSet -> SomeException
$ctoException :: EnvironmentVariableNotSet -> SomeException
Exception)
instance ToJSON EnvironmentVariableNotSet where
toJSON :: EnvironmentVariableNotSet -> Value
toJSON (EnvironmentVariableNotSet Text
msg) =
[Pair] -> Value
object
[ Key
"errorType" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
.= (Text
"EnvironmentVariableNotSet" :: Text),
Key
"errorMessage" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
.= Text
msg
]
data Parsing = Parsing
{ Parsing -> Text
errorMessage :: Text,
Parsing -> Text
actualValue :: Text,
Parsing -> Text
valueName :: Text
}
deriving (Int -> Parsing -> ShowS
[Parsing] -> ShowS
Parsing -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Parsing] -> ShowS
$cshowList :: [Parsing] -> ShowS
show :: Parsing -> String
$cshow :: Parsing -> String
showsPrec :: Int -> Parsing -> ShowS
$cshowsPrec :: Int -> Parsing -> ShowS
Show, Show Parsing
Typeable Parsing
SomeException -> Maybe Parsing
Parsing -> String
Parsing -> SomeException
forall e.
Typeable e
-> Show e
-> (e -> SomeException)
-> (SomeException -> Maybe e)
-> (e -> String)
-> Exception e
displayException :: Parsing -> String
$cdisplayException :: Parsing -> String
fromException :: SomeException -> Maybe Parsing
$cfromException :: SomeException -> Maybe Parsing
toException :: Parsing -> SomeException
$ctoException :: Parsing -> SomeException
Exception)
instance ToJSON Parsing where
toJSON :: Parsing -> Value
toJSON (Parsing Text
errorMessage Text
_ Text
valueName) =
[Pair] -> Value
object
[ Key
"errorType" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
.= (Text
"Parsing" :: Text),
Key
"errorMessage" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
.= (Text
"Could not parse '" forall a. Semigroup a => a -> a -> a
<> Text
valueName forall a. Semigroup a => a -> a -> a
<> Text
"': " forall a. Semigroup a => a -> a -> a
<> Text
errorMessage)
]
newtype Invocation
= Invocation LBS.ByteString
deriving (Int -> Invocation -> ShowS
[Invocation] -> ShowS
Invocation -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Invocation] -> ShowS
$cshowList :: [Invocation] -> ShowS
show :: Invocation -> String
$cshow :: Invocation -> String
showsPrec :: Int -> Invocation -> ShowS
$cshowsPrec :: Int -> Invocation -> ShowS
Show, Show Invocation
Typeable Invocation
SomeException -> Maybe Invocation
Invocation -> String
Invocation -> SomeException
forall e.
Typeable e
-> Show e
-> (e -> SomeException)
-> (SomeException -> Maybe e)
-> (e -> String)
-> Exception e
displayException :: Invocation -> String
$cdisplayException :: Invocation -> String
fromException :: SomeException -> Maybe Invocation
$cfromException :: SomeException -> Maybe Invocation
toException :: Invocation -> SomeException
$ctoException :: Invocation -> SomeException
Exception)