re-frame

https://github.com/Day8/re-frame/blob/master/docs/README.md https://github.com/Day8/re-frame/blob/master/docs/External-Resources.md
jmckitrick 2021-02-09T19:24:00.078Z

I have an issue where a new endpoint returned (ok) with no content, and http-fx seemed to swallow the error. I'm digging into the code, and cannot figure out where would be a good place to catch this. Even the on-error handler was not reached.

jmckitrick 2021-02-10T12:37:47.080100Z

Ah, ok. Let me take a look at that.

p-himik 2021-02-09T19:26:18.078100Z

> a new endpoint returned `(ok)` with no content, and `http-fx` seemed to swallow the error I'm assuming (ok) means 200 OK. If so, what is that error you write about?

jmckitrick 2021-02-09T19:33:37.078300Z

So apparently the response-format was expecting JSON, and 'nil' will not work. This makes sense, but it would be nice to see an error message somewhere saying the response format is not what was expected.

p-himik 2021-02-09T19:34:11.078500Z

Ah, so there's an exception somewhere saying that nil doesn't work?

jmckitrick 2021-02-09T19:35:11.078700Z

No, there's no exception at all. Just nothing. Neither success nor error handler are called.

jmckitrick 2021-02-09T19:35:25.078900Z

It swallows the error, so it's not logged or anything.

p-himik 2021-02-09T19:52:48.079100Z

I just tried the same and I got this in the :on-failure handler:

{:response nil,
 :last-method "GET",
 :original-text "",
 :last-error "",
 :failure :parse,
 :status-text
 "Unexpected end of JSON input  Format should have been JSON",
 :status 200, 
 :uri "/x", 
 :debug-message "No Error", 
 :last-error-code 0}

p-himik 2021-02-09T19:54:21.079300Z

So I can't really add anything without seeing your actual code.

p-himik 2021-02-09T19:55:22.079600Z

Oh, wait. In your OP you mention on-error. But day8.re-frame/http-fx expects :on-failure.