Class: Turbo::TurboError

Inherits:
NSError
  • Object
show all
Defined in:
lib/turbo/turbo_error.rb

Constant Summary collapse

ERROR_DOMAIN =
"com.basecamp.Turbolinks"
ERROR_CODES =
{
  http_failure: 0,
  network_failure: -1,
  content_type_mismatch: -2
}

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Attribute Details

#statusCodeObject

Returns the value of attribute statusCode.



9
10
11
# File 'lib/turbo/turbo_error.rb', line 9

def statusCode
  @statusCode
end

Class Method Details

.errorWithCode(code, error: error) ⇒ Object



16
17
18
# File 'lib/turbo/turbo_error.rb', line 16

def self.errorWithCode(code, localizedDescription: localizedDescription)
  errorWithDomain(ERROR_DOMAIN, code: ERROR_CODES[code], userInfo: { NSLocalizedDescriptionKey => localizedDescription })
end

.pageLoadFailureObject



11
12
13
14
# File 'lib/turbo/turbo_error.rb', line 11

def self.pageLoadFailure
  localizedDescription = "The page could not be loaded due to a configuration error."
  errorWithDomain(ERROR_DOMAIN, code: 123, userInfo: { NSLocalizedDescriptionKey => localizedDescription })
end