Skip to content

Commit

Permalink
fix(error-controller): fixed a problem with HTTPErrorHandler not ex…
Browse files Browse the repository at this point in the history
…ecuting translate logic
  • Loading branch information
imjuni committed Jan 25, 2024
1 parent b2405fb commit 1293e00
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"scripts": {
"clean": "rimraf dist",
"ctix": "ctix build --config .configs/.ctirc",
"ctix-rm": "ctix remove -p ./tsconfig.json --config .configs/.ctirc --force-yes --remove-backup",
"ctix-rm": "ctix remove --config .configs/.ctirc --force-yes --remove-backup",
"build": "pnpm run clean && tsc --incremental --project tsconfig.prod.json",
"dts": "tsc -p tsconfig.dts.json",
"dts-alias": "tsc-alias -p tsconfig.dts.json",
Expand Down
6 changes: 5 additions & 1 deletion src/handlers/HTTPErrorHandler.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { ApiError } from '#/errors/ApiError';
import { ErrorHandler } from '#/handlers/ErrorHandler';
import type { THTTPErrorHandlerParameters } from '#/handlers/interfaces/THTTPErrorHandlerParameters';
import { getSourceLocation } from '#/modules/getSourceLocation';
Expand Down Expand Up @@ -52,7 +53,10 @@ export class HTTPErrorHandler extends ErrorHandler<THTTPErrorHandlerParameters>

protected serializor(args: THTTPErrorHandlerParameters): { code: string; message?: string } {
const code = getSourceLocation(args.err);
const message = this.getMessage(args, { message: args.err.message });
const message = this.getMessage(args, {
translate: args.err instanceof ApiError ? args.err.reply.i18n : undefined,
message: args.err.message,
});
const encrypted =
this.option.encryption && EncryptContiner.isBootstrap
? EncryptContiner.it.encrypt(code)
Expand Down

0 comments on commit 1293e00

Please sign in to comment.