fix: refactor constructor parameter properties in errors.ts to prevent strip-only mode type stripping errors
This commit is contained in:
+11
-3
@@ -1,10 +1,15 @@
|
|||||||
export class AppError extends Error {
|
export class AppError extends Error {
|
||||||
|
public code: string;
|
||||||
|
public statusCode: number;
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
message: string,
|
message: string,
|
||||||
public code: string,
|
code: string,
|
||||||
public statusCode: number = 500,
|
statusCode: number = 500,
|
||||||
) {
|
) {
|
||||||
super(message);
|
super(message);
|
||||||
|
this.code = code;
|
||||||
|
this.statusCode = statusCode;
|
||||||
this.name = "AppError";
|
this.name = "AppError";
|
||||||
Error.captureStackTrace(this, this.constructor);
|
Error.captureStackTrace(this, this.constructor);
|
||||||
}
|
}
|
||||||
@@ -32,11 +37,14 @@ export class VoiceConnectionError extends AppError {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export class ValidationError extends AppError {
|
export class ValidationError extends AppError {
|
||||||
|
public details?: Record<string, string[]>;
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
message: string,
|
message: string,
|
||||||
public details?: Record<string, string[]>,
|
details?: Record<string, string[]>,
|
||||||
) {
|
) {
|
||||||
super(message, "VALIDATION_ERROR", 400);
|
super(message, "VALIDATION_ERROR", 400);
|
||||||
|
this.details = details;
|
||||||
this.name = "ValidationError";
|
this.name = "ValidationError";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user