Exception: WikipediaWrapper::PageError

Inherits:
WikipediaError show all
Defined in:
lib/wikipedia_wrapper/exception.rb

Overview

Exception raised when no Wikipedia matched a query.

Instance Method Summary collapse

Constructor Details

#initialize(term, pageid: false) ⇒ PageError

Returns a new instance of PageError.



47
48
49
50
# File 'lib/wikipedia_wrapper/exception.rb', line 47

def initialize(term, pageid: false)
  @pageid = pageid
  @term = term
end

Instance Method Details

#messageObject



52
53
54
55
56
57
58
# File 'lib/wikipedia_wrapper/exception.rb', line 52

def message
  if @pageid
    "Page id \"#{@term}\" does not match any pages. Try another id!"
  else
    "\"#{@term}\" does not match any pages. Try another query!"
  end
end