2023-12-13 20:08:24 +03:00
|
|
|
import getConfig from '../config/main';
|
2024-04-27 19:21:41 +03:00
|
|
|
import { TxtDotError } from '@txtdot/sdk/dist/types/errors';
|
2024-02-25 21:17:56 +03:00
|
|
|
|
2023-08-21 17:35:25 +03:00
|
|
|
export class LocalResourceError extends TxtDotError {
|
|
|
|
constructor() {
|
2023-12-13 20:08:24 +03:00
|
|
|
super(403, 'LocalResourceError', 'Proxying local resources is forbidden.');
|
2023-08-21 17:35:25 +03:00
|
|
|
}
|
|
|
|
}
|
2023-08-21 16:03:28 +03:00
|
|
|
|
2024-03-07 14:49:54 +03:00
|
|
|
export class UnsupportedMimetypeError extends TxtDotError {
|
|
|
|
constructor(expected: string, got?: string) {
|
|
|
|
super(
|
|
|
|
415,
|
|
|
|
'UnsupportedMimetypeError',
|
|
|
|
`Unsupported mimetype, expected ${expected}, got ${got}`
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2023-09-21 12:18:12 +03:00
|
|
|
export class NotHtmlMimetypeError extends TxtDotError {
|
|
|
|
constructor() {
|
|
|
|
super(
|
|
|
|
421,
|
2023-12-13 20:08:24 +03:00
|
|
|
'NotHtmlMimetypeError',
|
|
|
|
'Received non-HTML content, ' +
|
2024-03-07 14:49:54 +03:00
|
|
|
(getConfig().proxy.enabled
|
2023-12-13 20:08:24 +03:00
|
|
|
? 'use proxy instead of parser.'
|
|
|
|
: 'proxying is disabled by the instance admin.')
|
2023-09-21 12:18:12 +03:00
|
|
|
);
|
2023-08-16 13:20:24 +03:00
|
|
|
}
|
|
|
|
}
|