Add error messaging
This commit is contained in:
parent
3cd55961cb
commit
1d2e0726da
1 changed files with 16 additions and 0 deletions
16
scripts/messaging.js
Normal file
16
scripts/messaging.js
Normal file
|
@ -0,0 +1,16 @@
|
|||
class Messaging {
|
||||
/*
|
||||
Return an error message.
|
||||
|
||||
@param {object} INSTANCE - The response instance
|
||||
@param {object} ERROR - The error object
|
||||
*/
|
||||
static exception (INSTANCE, ERROR) {
|
||||
let MESSAGE = {error: {'name': ERROR.name, 'message': ERROR.message}};
|
||||
INSTANCE.json(MESSAGE);
|
||||
console.error(ERROR);
|
||||
return (MESSAGE);
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = {Messaging}
|
Loading…
Add table
Add a link
Reference in a new issue