Skip to content

Commit

Permalink
Honor err.no_translate during translation (#17)
Browse files Browse the repository at this point in the history
  • Loading branch information
shaunwarman committed Jan 29, 2020
1 parent 4d36b7f commit d50bb06
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 2 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@ node_modules
coverage
.nyc_output
lib
package-lock.json
3 changes: 2 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
language: node_js
node_js:
- '8'
- '10'
- '12'
- 'lts/*'
after_success:
npm run coverage
4 changes: 3 additions & 1 deletion src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,9 @@ async function errorHandler(err) {
function parseValidationError(ctx, err) {
// translate messages
const translate = message =>
_.isFunction(ctx.request.t) ? ctx.request.t(message) : message;
!err.no_translate && _.isFunction(ctx.request.t)
? ctx.request.t(message)
: message;

// passport-local-mongoose support
if (passportLocalMongooseErrorNames.includes(err.name)) {
Expand Down

0 comments on commit d50bb06

Please sign in to comment.