Method: Essential::APIError.from_exception
- Defined in:
- lib/essential/errors/api_error.rb
.from_exception(e) ⇒ Object
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/essential/errors/api_error.rb', line 8 def self.from_exception(e) case e # when SocketError # when NoMethodError when RestClient::ExceptionWithResponse new( http_status: e.http_code, body: e.http_body, response: e.response ) when RestClient::Exception new(http_status: e.http_code) # when Errno::ECONNREFUSED else raise e end end |