Skip to content

Commit

Permalink
Wrap error
Browse files Browse the repository at this point in the history
  • Loading branch information
mostafa committed Mar 5, 2024
1 parent 0398c2a commit 6948f24
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
2 changes: 1 addition & 1 deletion act/builtins.go
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ func Terminate(_ map[string]any, params ...sdkAct.Parameter) (any, error) {
if err != nil {
// This should never happen, since everything is hardcoded.
logger.Error().Err(err).Msg("Failed to encode the error response")
return nil, err
return nil, gerr.ErrMsgEncodeError.Wrap(err)
}
result["response"] = response
}
Expand Down
3 changes: 3 additions & 0 deletions errors/errors.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ const (
ErrCodeRunError
ErrCodeAsyncAction
ErrCodeEvalError
ErrCodeMsgEncodeError
)

var (
Expand Down Expand Up @@ -152,6 +153,8 @@ var (
ErrCodeKeyNotFound, "no matching policy", nil)
ErrEvalError = NewGatewayDError(
ErrCodeEvalError, "error evaluating expression", nil)
ErrMsgEncodeError = NewGatewayDError(
ErrCodeMsgEncodeError, "error encoding message", nil)

// Unwrapped errors.
ErrLoggerRequired = errors.New("terminate action requires a logger parameter")
Expand Down

0 comments on commit 6948f24

Please sign in to comment.