Exception: Rango::Exceptions::HttpError
- Inherits:
-
StandardError
- Object
- StandardError
- Rango::Exceptions::HttpError
- Defined in:
- lib/rango/exceptions.rb
Direct Known Subclasses
Instance Attribute Summary collapse
Class Method Summary collapse
- .headers ⇒ Object
- .message ⇒ Object
- .message=(message) ⇒ Object
- .name ⇒ Object
- .name=(name) ⇒ Object
- .status ⇒ Object
- .status=(status) ⇒ Object
Instance Method Summary collapse
- #headers ⇒ Object
-
#initialize(message = self.class.name, status = nil) ⇒ HttpError
constructor
raise Redirection.new(“/”, 301).
- #inspect ⇒ Object
- #name ⇒ Object
- #to_response ⇒ Object
- #to_snakecase ⇒ Object
Constructor Details
#initialize(message = self.class.name, status = nil) ⇒ HttpError
raise Redirection.new(“/”, 301)
74 75 76 77 |
# File 'lib/rango/exceptions.rb', line 74 def initialize( = self.class.name, status = nil) self.status = status unless status.nil? self. = end |
Instance Attribute Details
#backtrace ⇒ Object
29 30 31 |
# File 'lib/rango/exceptions.rb', line 29 def backtrace super || @backtrace end |
#message ⇒ Object
41 42 43 |
# File 'lib/rango/exceptions.rb', line 41 def @message ||= self.class. end |
#status ⇒ Object
61 62 63 |
# File 'lib/rango/exceptions.rb', line 61 def status @status ||= self.class.status end |
Class Method Details
.headers ⇒ Object
65 66 67 |
# File 'lib/rango/exceptions.rb', line 65 def self.headers @headers ||= {"Content-Type" => "text/html"} end |
.message ⇒ Object
33 34 35 36 37 38 |
# File 'lib/rango/exceptions.rb', line 33 def self. @message ||= begin self.superclass. rescue NoMethodError end end |
.message=(message) ⇒ Object
23 24 25 |
# File 'lib/rango/exceptions.rb', line 23 def self.() @message = end |
.name ⇒ Object
15 16 17 |
# File 'lib/rango/exceptions.rb', line 15 def self.name @name end |
.name=(name) ⇒ Object
11 12 13 |
# File 'lib/rango/exceptions.rb', line 11 def self.name=(name) @name = name end |
.status ⇒ Object
49 50 51 52 53 54 |
# File 'lib/rango/exceptions.rb', line 49 def self.status @status ||= begin self.superclass.status rescue NoMethodError end end |
.status=(status) ⇒ Object
45 46 47 |
# File 'lib/rango/exceptions.rb', line 45 def self.status=(status) @status = status end |
Instance Method Details
#headers ⇒ Object
69 70 71 |
# File 'lib/rango/exceptions.rb', line 69 def headers @headers ||= self.class.headers.dup end |
#inspect ⇒ Object
79 80 81 |
# File 'lib/rango/exceptions.rb', line 79 def inspect self.to_response.inspect end |
#name ⇒ Object
19 20 21 |
# File 'lib/rango/exceptions.rb', line 19 def name @name ||= self.class.name end |
#to_response ⇒ Object
89 90 91 |
# File 'lib/rango/exceptions.rb', line 89 def to_response [self.status, self.headers, [self.].compact] end |
#to_snakecase ⇒ Object
85 86 87 |
# File 'lib/rango/exceptions.rb', line 85 def to_snakecase self.class.name.gsub(" ", "_").downcase end |