score:0

in faraday, the order of registration of middlewares matters because it's a pipeline (similar to rack).

so if you put the :raise_error middleware before :json, the error's body will be parsed.

@client = faraday.new(url: base_url) do |faraday|
  faraday.request  :json

  faraday.response :raise_error
  faraday.response :json
end

Related Query

More Query from same tag