Skip to content
This repository has been archived by the owner on Oct 9, 2020. It is now read-only.

Commit

Permalink
Catch layer.match is not a function and kill
Browse files Browse the repository at this point in the history
Temporary measure to catch this issue and kill the process to stop express staying in a broken state
(expressjs#3916)
  • Loading branch information
webdevian authored Apr 18, 2019
1 parent dc538f6 commit 86278e4
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions lib/router/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -570,6 +570,12 @@ function gettype(obj) {
*/

function matchLayer(layer, path) {
if (!layer.match || typeof layer.match !== 'function') {
console.error('No layer.match', layer, path);
console.error('Killing Process');
process.exit(1);
}

try {
return layer.match(path);
} catch (err) {
Expand Down

0 comments on commit 86278e4

Please sign in to comment.