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.
14 15 16 17 |
# File 'lib/media_wiki/exception.rb', line 14 def initialize(code, info) @code, @info, @message = code, info, "API error: code '#{code}', info '#{info}'" end |
Instance Attribute Details
#code ⇒ Object (readonly)
Returns the value of attribute code.
12 13 14 |
# File 'lib/media_wiki/exception.rb', line 12 def code @code end |
#info ⇒ Object (readonly)
Returns the value of attribute info.
12 13 14 |
# File 'lib/media_wiki/exception.rb', line 12 def info @info end |
#message ⇒ Object (readonly)
Returns the value of attribute message.
12 13 14 |
# File 'lib/media_wiki/exception.rb', line 12 def @message end |
Instance Method Details
#to_s ⇒ Object
19 20 21 |
# File 'lib/media_wiki/exception.rb', line 19 def to_s "#{self.class}: #{@message}" end |