You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
First, thanks for this tool! I really like it so far.
I'm wondering a bit though how errors are supposed to be handled? Maybe I'm missing something, but what I'm seeing is this:
If I return a non-nil error from one of the service endpoints, a 500 is returned to the client with the body being the error message (https://github.com/pacedotdev/oto/blob/master/otohttp/templates/server.go.plush#L46-L47). On the client side, the response is assumed to be JSON though (https://github.com/pacedotdev/oto/blob/master/otohttp/templates/client.ts.plush#L38), which leads to a JS error like SyntaxError: Unexpected token c in JSON at position 0. So out-of-the-box that seems a bit broken ... and I'm a bit confused why the "service endpoint error" is not simply handled with s.server.OnErr(w, r, err), like in the other error cases? Would be great if you could shed some light on this!
The text was updated successfully, but these errors were encountered:
@michaelsauter that's fixed now. Remember, you are free to copy and make any changes you like to the templates. This is the easiest way to customise Oto.
First, thanks for this tool! I really like it so far.
I'm wondering a bit though how errors are supposed to be handled? Maybe I'm missing something, but what I'm seeing is this:
If I return a non-nil error from one of the service endpoints, a 500 is returned to the client with the body being the error message (https://github.com/pacedotdev/oto/blob/master/otohttp/templates/server.go.plush#L46-L47). On the client side, the response is assumed to be JSON though (https://github.com/pacedotdev/oto/blob/master/otohttp/templates/client.ts.plush#L38), which leads to a JS error like
SyntaxError: Unexpected token c in JSON at position 0
. So out-of-the-box that seems a bit broken ... and I'm a bit confused why the "service endpoint error" is not simply handled withs.server.OnErr(w, r, err)
, like in the other error cases? Would be great if you could shed some light on this!The text was updated successfully, but these errors were encountered: