Exception: BingSearch::ServiceError

Inherits:
StandardError
  • Object
show all
Defined in:
lib/bing-search/errors.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(code, message = nil) ⇒ ServiceError

Returns a new instance of ServiceError.

Parameters:

  • code (String)

    The error code returned by Bing

  • message (String) (defaults to: nil)


12
13
14
15
# File 'lib/bing-search/errors.rb', line 12

def initialize(code, message = nil)
  super(message)
  @code = code
end

Instance Attribute Details

#codeString (readonly)

The error code returned by Bing

Returns:

  • (String)


6
7
8
# File 'lib/bing-search/errors.rb', line 6

def code
  @code
end

Instance Method Details

#to_sString

Returns:

  • (String)


19
20
21
# File 'lib/bing-search/errors.rb', line 19

def to_s
  "Bing error #{code}: #{super}"
end