Closed ruricolist closed 4 years ago
Never mind, I only thought I had read the docs.
:-)
Actually, I don't remember anymore what the doc states anymore on this. But your "errors should be errors" sounds sensible. I'll review myself.
Yep it seems you need to use Snooze's API for this, explain-condition
. The reason they aren't error
is, if I remember correctly, a conscious design decision: "they are part of everyday HTTP life" I wrote. If they were errors, they would be caught by the error handlers designed for Lisp errors, and I don't think we want that. The reason I signal them with error
is, I believe, only a shortcut to a function that signal
s and then invokes the debugger if no handling happens in the meantime.
I think we want that: and there is indeed some default handling that checks the values of some variables.
This has been tested very summarily, Paul, and I'd love to know if this scheme is working out for you, or if you think it could be more flexible.
The conditions
no-such-resource
,no-such-route
, andinvalid-resource-arguments
are signaled witherror
, so they invoke the debugger, but are not subtypes oferror
(or evenserious-condition
), so they are not caught by handlers.From the production standpoint, this is bad. If the debugger is disabled, this means the app dies on every 404. If the debugger is not disabled, it hangs on every 404.
Of course, one could explicitly handle
http-condition
signals, but that isn't documented anywhere and I think it would be much less surprising if all the error conditions were actually of typeerror
.