The exception handler in Backend.Vault.Kv swallows a lot of info about thrown exceptions.
\case FailureResponse _request response ->
case statusCode $ responseStatusCode response of
404 -> Nothing
e -> Just $ OtherError (T.pack $ show e)
DecodeFailure text response -> Just MarshallingFailed
UnsupportedContentType mediaType response -> Just MarshallingFailed
InvalidContentTypeHeader response -> Just MarshallingFailed
ConnectionError exception -> Just ConnectError
In a few places we're also throwing MarshallingFailed without specifying why it failed (what we expected to receive, what we actually received).
case response ^. I.ddata . at ("version" :: T.Text) of
Just (A.Number i) -> maybe (throw MarshallingFailed) pure (S.toBoundedInteger i)
_ -> throw MarshallingFailed
maybeThrow = maybe (throw MarshallingFailed) pure
We also throw OtherError "404" without specifying which request failed.
throw $ OtherError "404"
We use eitherToMaybe that swallows error messages.
This makes exceptions extremely hard to troubleshoot.
We should make sure as much info as possible is preserved and displayed to the user.
Additionally, we should write a Buildable instance for CofferError and change the CLI to pretty-print error messages.
Backend.Vault.Kv
swallows a lot of info about thrown exceptions.MarshallingFailed
without specifying why it failed (what we expected to receive, what we actually received).OtherError "404"
without specifying which request failed.eitherToMaybe
that swallows error messages.This makes exceptions extremely hard to troubleshoot.
We should make sure as much info as possible is preserved and displayed to the user.
Additionally, we should write a
Buildable
instance forCofferError
and change the CLI to pretty-print error messages.Acceptance Criteria