[fixed] - eslint

This commit is contained in:
Swapnil Bendal
2024-12-17 19:43:28 +05:30
parent ac7b46c661
commit eb8b1d3c54
7 changed files with 112 additions and 82 deletions

View File

@@ -1,32 +1,33 @@
class ApiError<T = any> extends Error {
statusCode: number;
data: T | null;
message: string;
success: boolean;
errors: Array<any>;
isOperational: boolean;
stack?: string;
class ApiError<T = unknown> extends Error {
statusCode: number;
data: T | null;
message: string;
success: boolean;
errors: Array<unknown>;
isOperational: boolean;
stack?: string;
constructor(
statusCode: number,
message: string = 'Something went wrong',
errors: Array<any> = [],
isOperational: boolean = true,
stack: string = ''
) {
super(message);
this.statusCode = statusCode;
this.data = null;
this.message = message;
this.success = false;
this.errors = errors;
this.isOperational = isOperational;
constructor(
statusCode: number,
message: string = 'Something went wrong',
errors: Array<unknown> = [],
isOperational: boolean = true,
stack?: string
) {
super(message);
this.statusCode = statusCode;
this.data = null;
this.message = message;
this.success = false;
this.errors = errors;
this.isOperational = isOperational;
if (stack) {
this.stack = stack;
} else {
Error.captureStackTrace(this, this.constructor);
}
}
if (stack) {
this.stack = stack;
} else {
Error.captureStackTrace(this, this.constructor);
}
}
}
export default ApiError;
export default ApiError;