webio-node/includes/errorManager.js
2017-03-22 13:35:45 +08:00

9 lines
297 B
JavaScript

const manager = (errCode = '', lang = 'zh') => {
if(typeof lang != 'string' || !lang.trim()) lang = 'zh';
lang = lang.toLowerCase();
let errors = require(`./language/${lang}.json`);
if(errCode in errors) return errors[errCode];
else return 'Error Code not found';
}
module.exports = manager;