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.



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

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

Instance Method Details

#bodyObject



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

def body
  ''
end

#has_selector?(selector) ⇒ Boolean

Returns:

  • (Boolean)


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

def has_selector?(selector)
  false
end

#headersObject



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

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



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

def host
  ''
end


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

def links
  []
end

#statusObject



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

def status
  @error_code
end

#visited?Boolean

Returns:

  • (Boolean)


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

def visited?
  true
end