Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit e52cc92

Browse files
committed
fix(json-api-nestjs): Use correct options for check is debug or not
1 parent 5ca7132 commit e52cc92

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

libs/json-api/json-api-nestjs/src/lib/modules/mixin/service/error-format.service.ts

+4-5
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,12 @@ import {
55
InternalServerErrorException,
66
} from '@nestjs/common';
77
import { MODULE_OPTIONS_TOKEN } from '../../../constants';
8-
import { EntityControllerParam } from '../types';
9-
import { ValidateQueryError } from '../../../types';
8+
import { PrepareParams, ValidateQueryError } from '../../../types';
109
import { HttpExceptionOptions } from '@nestjs/common/exceptions/http.exception';
1110

1211
@Injectable()
1312
export class ErrorFormatService {
14-
@Inject(MODULE_OPTIONS_TOKEN) private config!: EntityControllerParam;
13+
@Inject(MODULE_OPTIONS_TOKEN) private config!: PrepareParams;
1514
private defaultErrorMsg = 'Internal Server Error';
1615
formatError(error: unknown): HttpException {
1716
if (error instanceof HttpException) {
@@ -20,7 +19,7 @@ export class ErrorFormatService {
2019

2120
const errMessage =
2221
error instanceof Error
23-
? this.config.debug
22+
? this.config.options.debug
2423
? error.message
2524
: this.defaultErrorMsg
2625
: this.defaultErrorMsg;
@@ -31,7 +30,7 @@ export class ErrorFormatService {
3130
path: [],
3231
};
3332

34-
const descriptionOrOptions: HttpExceptionOptions = this.config.debug
33+
const descriptionOrOptions: HttpExceptionOptions = this.config.options.debug
3534
? {
3635
description: this.defaultErrorMsg,
3736
cause: error instanceof Error ? error : undefined,

0 commit comments

Comments
 (0)