mirror of
https://github.com/nestjs/nest.git
synced 2026-02-21 23:11:44 +00:00
chore: resolve conflicts
This commit is contained in:
@@ -1,3 +1,7 @@
|
||||
import {
|
||||
HttpExceptionBody,
|
||||
HttpExceptionBodyMessage,
|
||||
} from '../interfaces/http/http-exception-body.interface';
|
||||
import { isObject, isString } from '../utils/shared.utils';
|
||||
|
||||
export interface HttpExceptionOptions {
|
||||
@@ -108,17 +112,42 @@ export class HttpException extends Error {
|
||||
}
|
||||
|
||||
public static createBody(
|
||||
objectOrErrorMessage: object | string,
|
||||
description?: string,
|
||||
nil: null | '',
|
||||
message: HttpExceptionBodyMessage,
|
||||
statusCode: number,
|
||||
): HttpExceptionBody;
|
||||
|
||||
public static createBody(
|
||||
message: HttpExceptionBodyMessage,
|
||||
error: string,
|
||||
statusCode: number,
|
||||
): HttpExceptionBody;
|
||||
|
||||
public static createBody<Body extends Record<string, unknown>>(
|
||||
custom: Body,
|
||||
): Body;
|
||||
|
||||
public static createBody<Body extends Record<string, unknown>>(
|
||||
arg0: null | HttpExceptionBodyMessage | Body,
|
||||
arg1?: HttpExceptionBodyMessage | string,
|
||||
statusCode?: number,
|
||||
) {
|
||||
if (!objectOrErrorMessage) {
|
||||
return { statusCode, message: description };
|
||||
): HttpExceptionBody | Body {
|
||||
if (!arg0) {
|
||||
return {
|
||||
message: arg1,
|
||||
statusCode: statusCode,
|
||||
};
|
||||
}
|
||||
return isObject(objectOrErrorMessage) &&
|
||||
!Array.isArray(objectOrErrorMessage)
|
||||
? objectOrErrorMessage
|
||||
: { statusCode, message: objectOrErrorMessage, error: description };
|
||||
|
||||
if (isString(arg0) || Array.isArray(arg0)) {
|
||||
return {
|
||||
message: arg0,
|
||||
error: arg1 as string,
|
||||
statusCode: statusCode,
|
||||
};
|
||||
}
|
||||
|
||||
return arg0;
|
||||
}
|
||||
|
||||
public static getDescriptionFrom(
|
||||
|
||||
@@ -26,6 +26,8 @@ export {
|
||||
FactoryProvider,
|
||||
ForwardReference,
|
||||
HttpServer,
|
||||
HttpExceptionBody,
|
||||
HttpExceptionBodyMessage,
|
||||
INestApplication,
|
||||
INestApplicationContext,
|
||||
INestMicroservice,
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
export * from './http-exception-body.interface';
|
||||
export * from './http-server.interface';
|
||||
export * from './message-event.interface';
|
||||
export * from './raw-body-request.interface';
|
||||
|
||||
Reference in New Issue
Block a user