handle errors. (TODO: handle errors *nicely*)

This commit is contained in:
Rich Harris
2017-12-13 12:24:12 -05:00
parent a8373c1568
commit c7e3fc4493

View File

@@ -39,6 +39,7 @@ module.exports = function connect(opts) {
return; return;
} }
try {
for (const route of routes) { for (const route of routes) {
if (route.test(url)) { if (route.test(url)) {
req.params = route.exec(url); req.params = route.exec(url);
@@ -89,5 +90,10 @@ module.exports = function connect(opts) {
} }
next(); next();
} catch(err) {
// TODO nice error pages
res.status(500);
res.end(err.message);
}
}; };
}; };