forked from ebdrup/nodeerrors
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* export function instead of value returned from function call * update package.json and bump node version * update tests * bump packages * bump mocha * require moduleconfig in function * use parent-module * use Debitoor fork of moduleconfig
- Loading branch information
1 parent
79ceee1
commit 946e0c3
Showing
27 changed files
with
3,672 additions
and
1,344 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
{ | ||
"esversion": 6, | ||
"asi" : false, | ||
"bitwise" : true, | ||
"boss" : false, | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
require: | ||
- ./test/common.js | ||
ui: bdd | ||
recursive: true | ||
timeout: 4000 |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,18 @@ | ||
"use strict"; | ||
'use strict'; | ||
module.exports = function(options){ | ||
|
||
var errors = require("nodeerrors"); | ||
const errors = require('nodeerrors'); | ||
return errorHandler; | ||
|
||
function errorHandler(err, req, res, next){ | ||
var error = errors.parse(err); | ||
const error = errors.parse(err); | ||
req.error = JSON.parse(JSON.stringify(error)); //for logging of internal messages by logger | ||
console.error(req.error); | ||
if(!req.param("callback")){ | ||
if(!req.param('callback')){ | ||
res.statusCode = error.http; //only non-jsonp should get http status codes other than 200 | ||
delete error.http; //do not show http code to users (it's send in header) | ||
} | ||
delete error.internal; //do not show internal messages to users | ||
res.json(error); | ||
} | ||
}; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.