mirror of
https://github.com/plankanban/planka.git
synced 2025-12-23 09:15:09 +03:00
66 lines
1.3 KiB
JavaScript
Executable File
66 lines
1.3 KiB
JavaScript
Executable File
/*!
|
|
* 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,
|
|
});
|
|
};
|