Closed
Description
Currently when a path is invalid the error is not very helpful, especially when code base is large.
I think this will be very helpful, in my case for example I am trying to migrate from express 4 to 5 (path-to-regexp v8.2.0)
For now, I am using this to log errors
const pathToRegex = require("path-to-regexp");
const override = (functionName) => {
const orgFunction = pathToRegex[functionName]
pathToRegex[functionName] = function () {
try{
return orgFunction.call(this, ...arguments);
}catch{
console.error("error", functionName, arguments);
}
}
};
override("match")
override("pathToRegexp")
override("compile")
override("parse")
override("stringify")
// import and use express after the override
Metadata
Metadata
Assignees
Labels
No labels