Class: HookDeck::Middleware::ErrorHandler

Inherits:
Faraday::Middleware
  • Object
show all
Defined in:
lib/hookdeck/middlewares/error_handler.rb

Overview

ErrorHandler is a Faraday middleware that provides standardized error handling for HTTP requests. It catches Faraday errors and converts them into specific HookDeck error types based on the response status and error type

Instance Method Summary collapse

Instance Method Details

#call(env) ⇒ Object

Executes the middleware

Parameters:

  • env (Hash)

    The Faraday environment hash

Raises:

  • (HookDeck::Error)

    Various error types based on the response



13
14
15
16
17
# File 'lib/hookdeck/middlewares/error_handler.rb', line 13

def call(env)
  @app.call(env)
rescue Faraday::Error => e
  handle_error(e, env)
end