import { Exception } from '@adonisjs/core/exceptions' import type { HttpContext } from '@adonisjs/core/http' /** * Thrown when a component selection is invalid, either because: * - the referenced component does not belong to the current user, or * - more than one component of the same "unique" type is being attached * to the same computer at once. */ export default class InvalidComponentSelectionException extends Exception { static status = 422 static code = 'E_INVALID_COMPONENT_SELECTION' handle(error: this, { response }: HttpContext) { return response.status(error.status).send({ errors: [{ message: error.message }] }) } }