Skip to content

Commit

Permalink
fix: only concatenate non-empty api error messages
Browse files Browse the repository at this point in the history
  • Loading branch information
nflaig committed Sep 23, 2023
1 parent 9618dd1 commit e290dc0
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion packages/api/src/utils/client/httpClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,11 @@ export class ApiError extends Error {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
static assert(res: ApiClientResponse, message?: string): asserts res is ApiClientSuccessResponse<any, unknown> {
if (!res.ok) {
throw new ApiError([message, res.error.message].join(" - "), res.error.code, res.error.operationId);
throw new ApiError(
[message, res.error.message].filter(Boolean).join(" - "),
res.error.code,
res.error.operationId
);
}
}

Expand Down

0 comments on commit e290dc0

Please sign in to comment.