Class: FaradayMiddleware::ChurchCommunityBuilderErrorHandler

Inherits:
Faraday::Middleware
  • Object
show all
Defined in:
lib/church_community_builder/error.rb

Constant Summary collapse

ERROR_STATUSES =
400..600

Instance Method Summary collapse

Instance Method Details

#on_complete(env) ⇒ Object



12
13
14
15
16
17
# File 'lib/church_community_builder/error.rb', line 12

def on_complete(env)
  case env[:status]
  when ERROR_STATUSES
    raise ChurchCommunityBuilder::Error, "#{env[:status]} #{env[:body]}"
  end
end