Files
speckle-server/packages/server/modules/notifications/errors/index.ts
T
Iain Sproat f93d9093a0 fix(errors): all error should define an appropriate status code (#3112)
* fix(errors): all error should define a status code (default is 500)
- rename NoInviteFoundError to InviteNotFoundError to match xNotFoundError pattern

* remove unused errors
2024-09-25 13:08:13 +02:00

24 lines
848 B
TypeScript

import { BaseError } from '@/modules/shared/errors/base'
export class UnhandledNotificationError extends BaseError {
static code = 'UNHANDLED_NOTIFICATION_ERROR'
static defaultMessage = 'A notification without a valid handler has arrived'
static statusCode = 500
}
export class InvalidNotificationError extends BaseError {
static code = 'INVALID_NOTIFICATION_ERROR'
static defaultMessage = 'Received an invalid notification'
static statusCode = 500
}
/**
* If this notification is thrown from a notification handler, the error will be logged, but
* the notification will be acknowledged and not re-queued
*/
export class NotificationValidationError extends BaseError {
static code = 'NOTIFICATION_VALIDATION_ERROR'
static defaultMessage = 'Processing a notification failed due to invalid metadata'
static statusCode = 500
}