Skip to content

Commit

Permalink
Simplify err body message parser
Browse files Browse the repository at this point in the history
  • Loading branch information
nflaig committed Apr 4, 2024
1 parent 3100d07 commit 127909d
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions packages/validator/src/util/externalSignerClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -196,12 +196,8 @@ async function handleExternalSignerResponse<T>(res: Response): Promise<T> {

function getErrorMessage(errBody: string): string {
try {
const errJson = JSON.parse(errBody) as {message: string};
if (errJson.message) {
return errJson.message;
} else {
return errBody;
}
const errJson = JSON.parse(errBody) as {message?: string};
return errJson.message ?? errBody;
} catch (e) {
return errBody;
}
Expand Down

0 comments on commit 127909d

Please sign in to comment.