[web-devel] Last call for comments: WAI 0.4
Michael Snoyman
michael at snoyman.com
Fri Apr 1 08:09:22 CEST 2011
On Wed, Mar 30, 2011 at 6:15 PM, Bas van Dijk <v.dijk.bas at gmail.com> wrote:
> On 30 March 2011 18:01, Michael Snoyman <michael at snoyman.com> wrote:
>> On Wed, Mar 30, 2011 at 5:58 PM, Bas van Dijk <v.dijk.bas at gmail.com> wrote:
>>> On 28 March 2011 09:02, Michael Snoyman <michael at snoyman.com> wrote:
>>>> Just wanted to give everyone a last chance to give input on WAI 0.4
>>>> before its release.
>>>
>>> Hi Michael,
>>>
>>> What's the role of the errorHandler :: String -> IO () in the Request type:
>>> https://github.com/snoyberg/wai/blob/master/Network/Wai.hs#L73 ?
>>> It seems a bit odd to have this in a request.
>>>
>>> Thanks,
>>>
>>> Bas
>>>
>>
>> The idea is to allow the server to give the application a general way
>> of logging error messages. Frankly, I don't personally use it at all,
>> and it was a relic from when I was trying to merge the original WAI
>> (proposed by Johan) and Hack. Do people have ideas on how to make it
>> more useful, or perhaps a better name for it? This is probably a good
>> area for improvement.
>
> Thanks for the explanation. I think it makes more sense to either
> remove the error handler or move it to the Application as in:
>
> type Application = ErrorHandler -> Request -> Iteratee B.ByteString IO Response
>
> type ErrorHandler = String -> IO ()
>
> Bas
>
After some WAI-team internal discussions, we're going to go with the
first option: removing errorHandler. We made this decision since:
1) None of us has actually ever used errorHandler in real life code.
2) None of the WAI backends do anything particularly intelligent with
the data. I think they all just print to stderr.
3) As you've pointed out, it's illogical to have it as part of a Request.
4) Since the backends aren't really doing something intelligent, the
programmer probably wants to supply his/her own logging function. This
can happen internally to the Application, without talking to the
handler at all.
The only downside I can see is that Middlewares won't have automatic
access to the logging function. However, I have yet to see a
Middleware that uses it, so I don't think it's a big loss.
I'll give another day or two for follow-up comments on WAI, and then release.
Michael
More information about the web-devel
mailing list