JP Moresmau
JP Moresmau

Reputation: 7403

ParseError in Yesod.Core.Class.Yesod

I have a Yesod web application, that calls a web service on another server. I reuse the Http Manager from yesod for my Requests to that web service. On some calls, I'm getting a Yesod error, and I'm not sure why the Yesod error handler is kicking in, since the error handling is not part of the Manager. My code does its own status handling on the HTTP response (I do let req' = req { H.checkStatus = \_ _ _ -> Nothing } on the request).

The error I'm getting:

07/Jun/2013:14:05:15 +0200 [Error#yesod-core] ParseError {errorContexts = [], errorMessage = "Failed reading: satisfy", errorPosition = 1:1} @(yesod-core-1.2.0.4:Yesod.Core.Class.Yesod ./Yesod/Core/Class/Yesod.hs:471:5)

I have the distinct impression that the web service returns an error, and Yesod is handling it instead of my code. My web service client code throws exception that are caught to be redirected to an error page, and this works well when I do errors in the invocation of the service, I just don't understand why I'm getting this ParseError on some requests.

I'm dumping the request and the response that I get from the web service, and I never see the response in my log, which seems to indicate that yesod is intercepting the response.

Any idea?

Upvotes: 2

Views: 140

Answers (1)

JP Moresmau
JP Moresmau

Reputation: 7403

OK, sorry for the stupid question, I've figured it out. The http-conduit code is throwing the ParseError, and my code was not catching it, so Yesod was barfing. If I catch the ParseError, I get my error page. Now, is it normal that http-conduit fails with such an abrupt message, I don't know, but I do think the web service is misbehaving anyway.

Upvotes: 1

Related Questions