Exception: MediaWiki::APIError
- Defined in:
- lib/media_wiki/exception.rb
Overview
Wrapper for errors returned by MediaWiki API. Possible codes are defined in www.mediawiki.org/wiki/API:Errors_and_warnings.
Warnings also throw errors with code ‘warning’, unless MediaWiki::Gateway#new was called with :ignorewarnings.
Instance Attribute Summary collapse
-
#code ⇒ Object
readonly
Returns the value of attribute code.
-
#info ⇒ Object
readonly
Returns the value of attribute info.
-
#message ⇒ Object
readonly
Returns the value of attribute message.
Instance Method Summary collapse
-
#initialize(code, info) ⇒ APIError
constructor
A new instance of APIError.
- #to_s ⇒ Object
Constructor Details
#initialize(code, info) ⇒ APIError
Returns a new instance of APIError.
12 13 14 15 16 |
# File 'lib/media_wiki/exception.rb', line 12 def initialize(code, info) @code = code @info = info @message = "API error: code '#{code}', info '#{info}'" end |
Instance Attribute Details
#code ⇒ Object (readonly)
Returns the value of attribute code.
10 11 12 |
# File 'lib/media_wiki/exception.rb', line 10 def code @code end |
#info ⇒ Object (readonly)
Returns the value of attribute info.
10 11 12 |
# File 'lib/media_wiki/exception.rb', line 10 def info @info end |
#message ⇒ Object (readonly)
Returns the value of attribute message.
10 11 12 |
# File 'lib/media_wiki/exception.rb', line 10 def @message end |
Instance Method Details
#to_s ⇒ Object
18 19 20 |
# File 'lib/media_wiki/exception.rb', line 18 def to_s "#{self.class.to_s}: #{@message}" end |