Class: TerrasmsApi::Error
- Inherits:
-
Object
- Object
- TerrasmsApi::Error
- Defined in:
- lib/terrasms_api/error.rb
Class Method Summary collapse
Class Method Details
.call ⇒ Object
3 4 5 6 7 8 9 10 11 12 13 14 |
# File 'lib/terrasms_api/error.rb', line 3 def self.call result = yield if result.to_i&.negative? raise "Internal error: #{result} see https://terasms.ru/documentation/api/http/errors" else result end rescue RestClient::Exception, RestClient::ExceptionWithResponse => e raise TerrasmsApi::RequestError, e rescue SocketError => e raise TerrasmsApi::ConnectionError, e end |