Skip to content

RequestError.new raises exception #86

@indirect

Description

@indirect

An exception is happening inside find_by_name, but the gem's RequestError exception class causes an error while wrapping the actual error.

My app code:

    Cloudflare.connect(token: Rails.application.config.cloudflare_api_token) do |c|
      c.zones.find_by_name("domain").purge_cache(files: urls)
    end

The backtrace:

TypeError: no implicit conversion of Symbol into Integer if error = value[:error]
[GEM_ROOT]/gems/cloudflare-4.4.0/lib/cloudflare/representation.rb:16 :in `[]`

The gem code:

class RequestError < StandardError

def initialize(request, value)
  if error = value[:error]
    super("#{request}: #{error}")
  elsif errors = value[:errors]
  [...]

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions