Files
bigcapital/packages/server/src/modules/Items/ServiceError.ts
2025-12-05 23:47:29 +02:00

22 lines
508 B
TypeScript

import { HttpStatus } from '@nestjs/common';
export class ServiceError extends Error {
errorType: string;
message: string;
payload: any;
httpStatus: HttpStatus;
constructor(errorType: string, message?: string, payload?: any, httpStatus?: HttpStatus) {
super(message);
this.errorType = errorType;
this.message = message || null;
this.payload = payload;
this.httpStatus = httpStatus || HttpStatus.BAD_REQUEST;
}
getStatus(): HttpStatus {
return this.httpStatus;
}
}