class MediawikiApi::ApiError

generic MediaWiki api errors

Attributes

response[R]

Public Class Methods

new(response = nil) click to toggle source
# File lib/mediawiki_api/exceptions.rb, line 6
def initialize(response = nil)
  @response = response
end

Public Instance Methods

code() click to toggle source
# File lib/mediawiki_api/exceptions.rb, line 10
def code
  response_data['code'] || '000'
end
info() click to toggle source
# File lib/mediawiki_api/exceptions.rb, line 14
def info
  response_data['info'] || 'unknown API error'
end
to_s() click to toggle source
# File lib/mediawiki_api/exceptions.rb, line 18
def to_s
  "#{info} (#{code})"
end

Private Instance Methods

response_data() click to toggle source
# File lib/mediawiki_api/exceptions.rb, line 24
def response_data
  if @response
    @response.data || {}
  else
    {}
  end
end