Zaid-Ajaj / Fable.Remoting

Type-safe communication layer (RPC-style) for F# featuring Fable and .NET Apps
https://zaid-ajaj.github.io/Fable.Remoting/
MIT License
272 stars 55 forks source link

expected error structure #338

Closed hesxenon closed 1 year ago

hesxenon commented 1 year ago

hey, sorry to open an issue for this, could you point to where the client handles error responses? Specifically which structure is expected?

Currently I'm sending {status: int; body: string} but that doesn't seem to be correct?

Zaid-Ajaj commented 1 year ago

The error returned from a Remoting backend is determined by the defined errorHandler see Error handling

Currently I'm sending {status: int; body: string} but that doesn't seem to be correct?

It's not about the shape, it's about the StatusCode in the response header, not the body.

In general however, any non-200 status code is an error on the client that results in ProxyRequestException. See how the client handles it

hesxenon commented 1 year ago

yeah, I had found that point in the client but I don't get what kind of body is expected.

Im asking because somewhere my response is translated into this error "Cannot convert {"text":"test"} to ["Array",null]"

Zaid-Ajaj commented 1 year ago

If the response status code is anything but 200 then you shouldn't involve the JSON converter

hesxenon commented 1 year ago

... I overwrote the statuscode by accident. Thx for your help :)