txtdot/src/errors/main.ts

32 lines
627 B
TypeScript
Raw Normal View History

2023-08-21 17:35:25 +03:00
export class TxtDotError extends Error {
code: number;
description: string;
constructor(code: number, description: string) {
super(description);
this.code = code;
this.description = description;
}
}
export class EngineParseError extends TxtDotError {
constructor(message: string) {
super(500, `Parse error: ${message}`);
}
}
export class LocalResourceError extends TxtDotError {
constructor() {
super(403, "Proxying local resources is forbidden.");
}
}
2023-08-21 16:03:28 +03:00
2023-08-16 13:20:24 +03:00
export class NotHtmlMimetypeError extends Error {
url: string;
2023-08-21 17:35:25 +03:00
2023-08-21 16:03:28 +03:00
constructor(url: string) {
2023-08-16 13:20:24 +03:00
super();
2023-08-21 16:03:28 +03:00
this.url = url;
2023-08-16 13:20:24 +03:00
}
}