class Faraday::Neoon::RaiseError

Public Instance Methods

call(env) click to toggle source
# File lib/faraday/neoon/raise_error.rb, line 5
def call(env)
  @app.call(env).on_complete do |env|
    case env[:status]
    when (400..499)
      raise "Neoon::Error::#{JSON.parse(env[:body])["cause"]["exception"]}".constantize.new(env[:response], env[:response].body)
    when (500..599)
      raise 'Something went error with Neo4j server.'
    end
  end
end