Feeding `on` with names of undefined functions kills router silently
scan opened this issue · 0 comments
scan commented
It's a quite simple problem I notices when I was refactoring my code. I changed the closures from
on('GET', '/bla', function () {
// Hic sunt ponies
});
to
on('GET', '/bla', 'getBla');
Suddenly my router gave me a 404
for every URL. After trying every call of on
separately, I found out that when you feed the function the name of an undefined function (typo, import error), the router will only stop adding new routes beyond that point and will give only 404.
It would be much better if the function would output some kind of runtime error to make debugging this easier.
I will perhaps look into the issue later when I have the time.