mirror of
https://github.com/kevin-DL/sapper.git
synced 2026-01-22 15:15:19 +00:00
handle errors. (TODO: handle errors *nicely*)
This commit is contained in:
@@ -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);
|
||||||
|
}
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
Reference in New Issue
Block a user