Exception: MediawikiApi::ApiError

Inherits:
StandardError
  • Object
show all
Defined in:
lib/mediawiki_api/exceptions.rb

Overview

generic MediaWiki api errors

Direct Known Subclasses

EditError

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(response) ⇒ ApiError

Returns a new instance of ApiError.


6
7
8
# File 'lib/mediawiki_api/exceptions.rb', line 6

def initialize(response)
  @response = response
end

Instance Attribute Details

#responseObject (readonly)

Returns the value of attribute response


4
5
6
# File 'lib/mediawiki_api/exceptions.rb', line 4

def response
  @response
end

Instance Method Details

#codeObject


10
11
12
# File 'lib/mediawiki_api/exceptions.rb', line 10

def code
  data['code']
end

#infoObject


14
15
16
# File 'lib/mediawiki_api/exceptions.rb', line 14

def info
  data['info']
end

#to_sObject


18
19
20
# File 'lib/mediawiki_api/exceptions.rb', line 18

def to_s
  "#{info} (#{code})"
end