/*! * Copyright (c) 2024 PLANKA Software GmbH * Licensed under the Fair Use License: https://github.com/plankanban/planka/blob/master/LICENSE.md */ /** * notFound.js * * A custom response. * * Example usage: * ``` * return res.notFound(); * // -or- * return res.notFound(optionalData); * ``` * * Or with actions2: * ``` * exits: { * somethingHappened: { * responseType: 'notFound' * } * } * ``` * * ``` * throw 'somethingHappened'; * // -or- * throw { somethingHappened: optionalData } * ``` */ /** * @swagger * components: * responses: * NotFound: * description: Resource not found * content: * application/json: * schema: * type: object * required: * - code * - message * properties: * code: * type: string * description: Error code * example: E_NOT_FOUND * message: * type: string * description: Error message * example: Resource not found */ module.exports = function notFound(message) { const { res } = this; return res.status(404).json({ code: 'E_NOT_FOUND', message, }); };