@opra/common
Version:
Opra common package
20 lines (19 loc) • 712 B
JavaScript
import { HttpStatusCode } from '../../enums/index.js';
import { OpraHttpError } from '../opra-http-error.js';
/**
* The server cannot find the requested resource.
* This can also mean that the endpoint is valid but the resource itself does not exist.
*/
export class ResourceNotAvailableError extends OpraHttpError {
constructor(resource, keyValue, cause) {
super({
message: `Resource "${resource}${keyValue ? '/' + keyValue : ''}" is not available`,
severity: 'error',
code: 'RESOURCE_NOT_AVAILABLE',
details: {
resource,
key: keyValue,
},
}, cause, HttpStatusCode.UNPROCESSABLE_ENTITY);
}
}