Exception: Http::ParserError

Inherits:
RuntimeError
  • Object
show all
Defined in:
lib/http/parser.rb

Overview

An exception class for HTTP parser errors. Includes an HTTP Error Code number that corresponds to the difficulty parsing (ie. 414 for Request-URI Too Long)

Defined Under Namespace

Classes: BadRequest, LengthRequired, NotImplemented, RequestEntityTooLarge, RequestTimeout, RequestURITooLong

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(string = "Bad Request", code = 400, headers = {}) ⇒ ParserError

Returns a new instance of ParserError.



19
20
21
22
23
# File 'lib/http/parser.rb', line 19

def initialize(string = "Bad Request", code = 400, headers = {})
  super(string)
  @code = code
  @headers = headers
end

Instance Attribute Details

#codeObject (readonly)

The error code that corresponds to the parsing error.



15
16
17
# File 'lib/http/parser.rb', line 15

def code
  @code
end

#headersObject (readonly)

Headers that should be sent back with the error reply as a hash.



17
18
19
# File 'lib/http/parser.rb', line 17

def headers
  @headers
end