Skip to content

Add return option to #error_handling #269

Description

@ryz310

Some API returns 404 Not Found as normal operation.
In the case, the error handler raises error is not kindness.

I hope to return nil or false in that case.

# Example.
class SomeApiClient < MyApiClient::Base
  endpoint 'https://example.com'

  error_handling status_code: 404, return: nil

  def get_resource
    get 'path/to/resource'
  end
end

api_client = SomeApiClient.new
response = api_client.get_resource # 404 Not Found
# => nil

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