Class: Grell::Page::ErroredPage

Inherits:
Object
  • Object
show all
Defined in:
lib/grell/page.rb

Overview

Private class. This is a result page when some error happened. It provides some information about the error.

Instance Method Summary collapse

Constructor Details

#initialize(error_code, exception) ⇒ ErroredPage

Returns a new instance of ErroredPage.



116
117
118
119
# File 'lib/grell/page.rb', line 116

def initialize(error_code, exception)
  @error_code = error_code
  @exception = exception
end

Instance Method Details

#bodyObject



125
126
127
# File 'lib/grell/page.rb', line 125

def body
  ''
end

#has_selector?(selector) ⇒ Boolean

Returns:

  • (Boolean)


155
156
157
# File 'lib/grell/page.rb', line 155

def has_selector?(selector)
  false
end

#headersObject



129
130
131
132
133
134
135
136
137
138
139
140
141
# File 'lib/grell/page.rb', line 129

def headers
  message = begin
    @exception.message
  rescue StandardError
    "Error message can not be accessed" #Poltergeist may try to access a nil object when accessing message
  end

  {
    grellStatus: 'Error',
    errorClass: @exception.class.to_s,
    errorMessage: message
  }
end

#hostObject



147
148
149
# File 'lib/grell/page.rb', line 147

def host
  ''
end


143
144
145
# File 'lib/grell/page.rb', line 143

def links
  []
end

#statusObject



121
122
123
# File 'lib/grell/page.rb', line 121

def status
  @error_code
end

#visited?Boolean

Returns:

  • (Boolean)


151
152
153
# File 'lib/grell/page.rb', line 151

def visited?
  true
end