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.



118
119
120
121
# File 'lib/grell/page.rb', line 118

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

Instance Method Details

#bodyObject



127
128
129
# File 'lib/grell/page.rb', line 127

def body
  ''
end

#has_selector?(selector) ⇒ Boolean

Returns:

  • (Boolean)


157
158
159
# File 'lib/grell/page.rb', line 157

def has_selector?(selector)
  false
end

#headersObject



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

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



149
150
151
# File 'lib/grell/page.rb', line 149

def host
  ''
end


145
146
147
# File 'lib/grell/page.rb', line 145

def links
  []
end

#statusObject



123
124
125
# File 'lib/grell/page.rb', line 123

def status
  @error_code
end

#visited?Boolean

Returns:

  • (Boolean)


153
154
155
# File 'lib/grell/page.rb', line 153

def visited?
  true
end