Skip to content

Commit

Permalink
refactor: jsonErrorReplacer to use explicit Error type (#125)
Browse files Browse the repository at this point in the history
  • Loading branch information
h3ssan authored Aug 26, 2024
1 parent a00e3a4 commit c51cc5d
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/handler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -880,10 +880,11 @@ function jsonErrorReplacer(
// GraphQL errors implement their own stringer
!isGraphQLError(val)
) {
const error = val as Error;
return {
// name: val.name, name is included in message
message: val.message,
// stack: val.stack, can leak sensitive details
// name: error.name, name is included in message
message: error.message,
// stack: error.stack, can leak sensitive details
};
}
return val;
Expand Down

0 comments on commit c51cc5d

Please sign in to comment.