help-me-respond
Advanced tools
Comparing version 2.0.1 to 2.0.2
25
index.js
@@ -8,11 +8,18 @@ let CONFIG = {}; | ||
} catch (e) { | ||
CONFIG = require('./_default'); | ||
try { | ||
CONFIG = require('./_default'); | ||
} catch (e) { | ||
console.error('ERROR Help me respond: You are missing default.json file in your config folder or it is missing json inside.') | ||
} | ||
} | ||
try { | ||
USER_DEFINED_MESSAGES = require('../../config/messages'); | ||
USER_DEFINED_MESSAGES = require("../../config/messages"); | ||
} catch (e) { | ||
USER_DEFINED_MESSAGES = require('./_messages'); | ||
try { | ||
USER_DEFINED_MESSAGES = require('./_messages'); | ||
} catch (e) { | ||
console.warn('WARNING Help me respond: You are missing messages.json file in your config folder or it is missing json inside.') | ||
} | ||
} | ||
if (CONFIG && CONFIG.lang && CONFIG.langFile) { | ||
@@ -124,4 +131,3 @@ I18N = require('i18n-nodejs')(CONFIG.lang, CONFIG.langFile); | ||
msg = { | ||
message: getMessage(msg, args), | ||
stack: stack | ||
message: getMessage(msg, args) | ||
} | ||
@@ -132,3 +138,6 @@ } | ||
msg = { | ||
error: msg, | ||
error: { | ||
message: msg.message, | ||
stack: stack | ||
} | ||
} | ||
@@ -155,3 +164,3 @@ } | ||
// we found translation for this msg in locales file | ||
if (result !== msg) { | ||
if (result && result !== msg) { | ||
return result; | ||
@@ -158,0 +167,0 @@ } |
{ | ||
"name": "help-me-respond", | ||
"version": "2.0.1", | ||
"version": "2.0.2", | ||
"description": "Simple nodejs Express http response helper", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
16747
384