[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Attaching context info to an error
From: |
João Távora |
Subject: |
Re: Attaching context info to an error |
Date: |
Wed, 27 Dec 2023 18:28:49 +0000 |
On Wed, Dec 27, 2023 at 6:08 PM João Távora <joaotavora@gmail.com> wrote:
> > Could you give some concrete examples of things you'd (be able to) do
> > with it?
> Just look at anyCL program that uses conditions, there are
> very many of them. One of them is Snooze [1] which uses them
> to represent HTTP error codes.
To elaborate a little more, Snooze is (I think) a good example
of how 'handler-bind' and 'restart-case' can cooperate to
allow different modes of operation for a HTTP server (or
HTTP REST router, which is what Snooze really is). You
may want to catch or not catch error conditions, catch or
not catch HTTP conditions, debug these conditions in your
Lisp (or via Emacs with SLY/SLIME), explain these conditions
to the HTTP client verbosely (in developement environments)
, succinctly (in production environments), muffle them,
log them, etc.
The file
https://github.com/joaotavora/snooze/blob/master/common.lisp
contains the meat and bones of this logic, and
https://github.com/joaotavora/snooze/blob/master/api.lisp
contains a reasonably well docstring'ed description of the
interface to these facilities. See the docstrings of
*catch-http-conditions* and *catch-errors*.
Restarts like 'explain-verbosely' and 'explain-succinctly'
are shown to the user when the debugger is popped. During
development the user can thus interactively control what
gets sent to the client (usually a web-browser in another
window). Unattended operation of such a server is achieved by
automatically invoking these restarts from handler-bind
handlers.
João
- Re: Attaching context info to an error, (continued)
- Re: Attaching context info to an error, João Távora, 2023/12/22
- Re: Attaching context info to an error, Stefan Monnier, 2023/12/27
- Re: Attaching context info to an error, João Távora, 2023/12/27
- Re: Attaching context info to an error,
João Távora <=
- Re: Attaching context info to an error, Stefan Monnier, 2023/12/27
- Re: Attaching context info to an error, João Távora, 2023/12/27
- Re: Attaching context info to an error, Stefan Monnier, 2023/12/27
- Re: Attaching context info to an error, João Távora, 2023/12/27
- Re: Attaching context info to an error, Stefan Monnier, 2023/12/28
- Re: Attaching context info to an error, João Távora, 2023/12/28
- Re: Attaching context info to an error, Stefan Monnier, 2023/12/28
- Re: Attaching context info to an error, João Távora, 2023/12/28
- Re: Attaching context info to an error, Stefan Monnier, 2023/12/28
- Re: Attaching context info to an error, João Távora, 2023/12/28