cobot / cobot_client

A client for the Cobot API plus helpers.
MIT License
1 stars 5 forks source link

QUESTION How to unveil errors / response bodies / etc ? #5

Closed ghost closed 6 years ago

ghost commented 6 years ago

Hello,

let's say I go

@cobot_client.post(url, params)

I get back

CobotClient::ResourceNotFound: 404 Resource Not Found

or maybe I get back

CobotClient::Forbidden: 403 Forbidden

Question

How can I see the body of the actual response? I need to figure out e.g. why I am getting the error that I am getting. Why is it 403? I'd like to access more of the answer that Cobot API is serving back. Any idea on how I could do this? 🙂

langalex commented 6 years ago
rescue CobotClient::NotFound => e
  p e.response
end

This comes from rest-client btw.

ghost commented 6 years ago

@langalex thank you!