Added File Error
This commit is contained in:
parent
d0f2441ed4
commit
e795419b78
26
src/core/error/FileError.ts
Normal file
26
src/core/error/FileError.ts
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
import BaseError from "@/core/error/BaseError";
|
||||
|
||||
export const FileErrorCodes = [
|
||||
"INVALID_IMAGE_FORMAT",
|
||||
"IMAGE_TOO_LARGE",
|
||||
] as const;
|
||||
|
||||
interface FileErrorOptions {
|
||||
message?: string;
|
||||
errorCode: (typeof FileErrorCodes)[number] | (string & {});
|
||||
statusCode?: number;
|
||||
}
|
||||
|
||||
export default class FileError extends BaseError {
|
||||
errorCode: (typeof FileErrorCodes)[number] | (string & {});
|
||||
|
||||
constructor(options: FileErrorOptions) {
|
||||
super({
|
||||
errorCode: options.errorCode,
|
||||
message: options.message,
|
||||
statusCode: options.statusCode,
|
||||
});
|
||||
|
||||
this.errorCode = options.errorCode;
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user