Exception: Minisky::FieldNotSetError

Inherits:
Error
  • Object
show all
Defined in:
lib/minisky/errors.rb

Overview

Raised by Requests#fetch_all when the field parameter isn’t set.

The message of the exception lists the fields available in the first fetched page.

Examples:

Making a request in the console with empty field

sky = Minisky.new('public.api.bsky.app', nil)
# => #<Minisky:0x0000000120f5f6b0 @host="public.api.bsky.app", ...>

sky.fetch_all('app.bsky.graph.getFollowers', { actor: 'sdk.blue' })
# ./lib/minisky/requests.rb:270:in 'block in Minisky::Requests#fetch_all':
#   Field parameter not provided; available fields: ["followers"] (Minisky::FieldNotSetError)

sky.fetch_all('app.bsky.graph.getFollowers', { actor: 'sdk.blue' }, field: 'followers')
# => .....

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(fields) ⇒ FieldNotSetError

Returns a new instance of FieldNotSetError.

Parameters:

  • fields (Array<String>)

    list of fields in the response data



117
118
119
120
# File 'lib/minisky/errors.rb', line 117

def initialize(fields)
  @fields = fields
  super("Field parameter not provided; available fields: #{@fields.inspect}")
end

Instance Attribute Details

#fieldsArray<String> (readonly)

Returns list of fields in the response data.

Returns:

  • (Array<String>)

    list of fields in the response data



113
114
115
# File 'lib/minisky/errors.rb', line 113

def fields
  @fields
end