Exception: Rockbox::GraphQLError

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

Overview

Raised when rockboxd returns a GraphQL ‘errors` payload.

Examples:

begin
  client.playback.play
rescue Rockbox::GraphQLError => e
  puts e.errors.first[:message]
end

Instance Attribute Summary collapse

Attributes inherited from Error

#cause

Instance Method Summary collapse

Constructor Details

#initialize(errors) ⇒ GraphQLError

Returns a new instance of GraphQLError.



28
29
30
31
# File 'lib/rockbox/errors.rb', line 28

def initialize(errors)
  @errors = Array(errors)
  super(@errors.map { |e| e[:message] || e["message"] }.compact.join("; "))
end

Instance Attribute Details

#errorsObject (readonly)

Returns the value of attribute errors.



26
27
28
# File 'lib/rockbox/errors.rb', line 26

def errors
  @errors
end