webio-node/includes/errorManager.js

9 lines
297 B
JavaScript
Raw Permalink Normal View History

2017-03-22 05:35:45 +00:00
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;