Skip to content

Commit

Permalink
feat(break): error response format
Browse files Browse the repository at this point in the history
  • Loading branch information
izatop committed Jun 22, 2023
1 parent a623dbc commit 02aed80
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions packages/web/src/Transport/TransformError.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,10 +63,12 @@ export class TransformError {
}

private getResponseJSON(): Record<any, any> {
const {code, status: message = this.#error.message} = this.getStatus();

if (isReadableError(this.#error)) {
return this.#error.toSafeJSON();
return {code, message, data: this.#error.toSafeJSON()};
}

return {error: this.#error.message};
return {code, message};
}
}

0 comments on commit 02aed80

Please sign in to comment.