obrand-admin-server/server/units/md-errors.js

39 lines
1.3 KiB
JavaScript
Raw Normal View History

/**
*
* User: Martin Donnelly
* Date: 2016-03-10
* Time: 11:31
*
*/
var logger = require('log4js').getLogger();
var MDERRORS = new function() {
'use strict';
var errors = {
1000: {name: 'Account error', title: 'Signup data missing'},
1001: {name: 'Account error', title: 'Email address is not in the correct format'},
1002: {name: 'Account error', title: 'Required details missing'},
1003: {name: 'Account error', title: 'Email does not exist in login table'},
1004: {name: 'Account error', title: 'Email address or password are incorrect'},
1100: {name: 'Company Error', title: 'Company name is missing'},
1101: {name: 'Company Error', title: 'Address details are missing'},
1102: {name: 'Company Error', title: 'Town/County details are missing'},
1103: {name: 'Company Error', title: 'Postcode is missing / incorrect'},
1104: {name: 'Company Error', title: 'Contact phone number is missing'},
1105: {name: 'Company Error', title: 'Email is missing / invalid'}
};
this.error = function(code) {
var estring = '';
estring = errors[code].name + ': ' + errors[code].title + '\nCode: ' + code + '\n';
logger.error(estring);
return ({code: code, name: errors[code].name, title: errors[code].title, string: estring});
};
}();
module.exports = MDERRORS;