Class: Userbin::Request::Middleware::RequestErrorHandler
- Inherits:
-
Faraday::Middleware
- Object
- Faraday::Middleware
- Userbin::Request::Middleware::RequestErrorHandler
- Defined in:
- lib/userbin/request.rb
Overview
Handle request errors
Instance Method Summary collapse
Instance Method Details
#call(env) ⇒ Object
47 48 49 50 51 52 53 54 55 56 |
# File 'lib/userbin/request.rb', line 47 def call(env) env.request.timeout = Userbin.config.request_timeout begin @app.call(env) rescue Faraday::ConnectionFailed raise Userbin::RequestError, 'Could not connect to Userbin API' rescue Faraday::TimeoutError raise Userbin::RequestError, 'Userbin API timed out' end end |