Skip to content

Add only and except options to #error_handling #270

Description

@ryz310
class SomeApiClient < MyApiClient::Base
  endpoint 'https://example.com'

  error_handling status_code: 400, raise: Errors::BadRequest, except: :create_resource
  error_handling status_code: 404, raise: Errors::NotFound, only: :get_resource

  def get_resource
    get 'path/to/resource'
  end

  def create_resource(body)
    post 'path/to/resource', body: body
  end
end

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions