extracting server side root cause exception


Karl Baum <karl.baum@...>
 

I am using rest-client to hit a sinatra api that is expected to have
the occasional server side error. I would like to grab the root cause
of this server side error from env["sinatra.error"], but i am unsure
of the proper way to do that with rest-client.

thx.

-karl


code@...
 

I am using rest-client to hit a sinatra api that is expected to have
the occasional server side error. I would like to grab the root cause
of this server side error from env["sinatra.error"], but i am unsure
of the proper way to do that with rest-client.
Hi,

I'm not sure to understand: do you develop both the sinatra server and the
client that use rest-client to call it ?

In this case you should use the sinatra error hnadling mechanism to return
the error to the client with an adequate http status, then catch the
corresponding exception when doing the rest-client call

Does this make sens to you ?

A.