56 lines
1.4 KiB
TypeScript
56 lines
1.4 KiB
TypeScript
import ApiException from '#exceptions/api_exception'
|
|
|
|
export class PageNotFoundException extends ApiException {
|
|
static status = 404
|
|
static code = 'E_PAGE_NOT_FOUND'
|
|
|
|
constructor(resource: string = 'Page') {
|
|
super(`${resource} not found`)
|
|
}
|
|
}
|
|
|
|
export class PageRouteConflictException extends ApiException {
|
|
static status = 409
|
|
static code = 'E_PAGE_ROUTE_CONFLICT'
|
|
|
|
constructor(locale: string, path: string) {
|
|
super(`A page already uses /${locale}/${path}`)
|
|
}
|
|
}
|
|
|
|
export class PageNotPublishedException extends ApiException {
|
|
static status = 409
|
|
static code = 'E_PAGE_NOT_PUBLISHED'
|
|
|
|
constructor() {
|
|
super('Only a published page can be unpublished')
|
|
}
|
|
}
|
|
|
|
export class InvalidPagePayloadException extends ApiException {
|
|
static status = 422
|
|
static code = 'E_INVALID_PAGE_PAYLOAD'
|
|
|
|
constructor(message: string = 'Invalid page payload') {
|
|
super(message)
|
|
}
|
|
}
|
|
|
|
export class PageMediaFileMissingException extends ApiException {
|
|
static status = 422
|
|
static code = 'E_PAGE_MEDIA_FILE_MISSING'
|
|
|
|
constructor(fileKey: string) {
|
|
super(`Missing uploaded file for key "${fileKey}"`)
|
|
}
|
|
}
|
|
|
|
export class PageMediaFileInvalidException extends ApiException {
|
|
static status = 422
|
|
static code = 'E_PAGE_MEDIA_FILE_INVALID'
|
|
|
|
constructor(fileKey: string, message?: string) {
|
|
super(message || `Invalid uploaded file for key "${fileKey}"`)
|
|
}
|
|
}
|