[hunchentoot-devel] Using json-rpc and Hunchentoot

I am developing a Hunchentoot server that communicates using json-rpc 2.0. The default Hunchentoot error messages are html formatted and I need to make a json-rpc version of these messages. I see that I can use *http-error-handler* to make a custom error message for a given error code in whatever format I like. That works just fine. However, the default Hunchentoot error messages have additional (important) information, such as the actual lisp error message for a lisp error. (This is given in the "content" argument of the function "start-output" in headers.lisp.) I need to be able to include this additional information in my json-rpc formatted error messages. How would I do this? Brett van de Sande

On Wed, Apr 08, 2009 at 05:16:47PM -0700, Brett van de Sande wrote:
However, the default Hunchentoot error messages have additional (important) information, such as the actual lisp error message for a lisp error. (This is given in the "content" argument of the function "start-output" in headers.lisp.) I need to be able to include this additional information in my json-rpc formatted error messages.
How would I do this?
In Weblocks we have put a HANDLER-CASE around our request handler to catch internal errors outselves and then display the appropriate error message.

On Thu, Apr 9, 2009 at 09:45, Leslie P. Polzer <sky@viridian-project.de> wrote:
On Wed, Apr 08, 2009 at 05:16:47PM -0700, Brett van de Sande wrote:
However, the default Hunchentoot error messages have additional (important) information, such as the actual lisp error message for a lisp error. (This is given in the "content" argument of the function "start-output" in headers.lisp.) I need to be able to include this additional information in my json-rpc formatted error messages.
How would I do this?
In Weblocks we have put a HANDLER-CASE around our request handler to catch internal errors outselves and then display the appropriate error message.
If you want to deliver a 500 HTTP status code, put 500 to the HUNCHENTOOT:*APPROVED-RETURN-CODES* list in order to prevent Hunchentoot's error handling mechanism intercept and mess with the response. Edi and I discussed that topic yesterday and we think that there are some improvements to be made in how Hunchentoot handles errors. Expect changes in that area. -Hans

In Weblocks we have put a HANDLER-CASE around our request handler to catch internal errors outselves and then display the appropriate error message.
If you want to deliver a 500 HTTP status code, put 500 to the HUNCHENTOOT:*APPROVED-RETURN-CODES* list in order to prevent Hunchentoot's error handling mechanism intercept and mess with the response. Edi and I discussed that topic yesterday and we think that there are some improvements to be made in how Hunchentoot handles errors. Expect changes in that area.
Just to make things clear: I am not particularly interested in lisp errors in my own code: I already have a handler-case for that. Brett
participants (3)
-
Brett van de Sande
-
Hans Hübner
-
Leslie P. Polzer