Exceptions¶
-
exception
headerparser.errors.
Error
[source]¶ Bases:
Exception
Superclass for all custom exceptions raised by the package
Parser Errors¶
-
exception
headerparser.errors.
ParserError
[source]¶ Bases:
headerparser.errors.Error
,ValueError
Superclass for all custom exceptions related to errors in parsing
-
exception
headerparser.errors.
BodyNotAllowedError
[source]¶ Bases:
headerparser.errors.ParserError
Raised when
body=False
and the parser encounters a message body
-
exception
headerparser.errors.
DuplicateFieldError
(name)[source]¶ Bases:
headerparser.errors.ParserError
Raised when a header field not marked as multiple occurs two or more times in the input
-
name
= None¶ The name of the duplicated header field
-
-
exception
headerparser.errors.
FieldTypeError
(name, value, exc_value)[source]¶ Bases:
headerparser.errors.ParserError
Raised when a
type
callable raises an exception-
exc_value
= None¶ The exception raised by the
type
callable
-
name
= None¶ The name of the header field for which the
type
callable was called
-
value
= None¶ The value on which the
type
callable was called
-
-
exception
headerparser.errors.
InvalidChoiceError
(name, value)[source]¶ Bases:
headerparser.errors.ParserError
Raised when a header field is given a value that is not one of its allowed choices
-
name
= None¶ The name of the header field
-
value
= None¶ The invalid value
-
-
exception
headerparser.errors.
MissingBodyError
[source]¶ Bases:
headerparser.errors.ParserError
Raised when
body=True
but there is no message body in the input
-
exception
headerparser.errors.
MissingFieldError
(name)[source]¶ Bases:
headerparser.errors.ParserError
Raised when a header field marked as required is not present in the input
-
name
= None¶ The name of the missing header field
-
-
exception
headerparser.errors.
UnknownFieldError
(name)[source]¶ Bases:
headerparser.errors.ParserError
Raised when an unknown header field is encountered and additional header fields are not enabled
-
name
= None¶ The name of the unknown header field
-
Scanner Errors¶
-
exception
headerparser.errors.
ScannerError
[source]¶ Bases:
headerparser.errors.Error
,ValueError
Superclass for all custom exceptions related to errors in scanning
-
exception
headerparser.errors.
MalformedHeaderError
(line)[source]¶ Bases:
headerparser.errors.ScannerError
Raised when the scanner encounters an invalid header line, i.e., a line without either a colon or leading whitespace
-
line
= None¶ The invalid header line
-
-
exception
headerparser.errors.
UnexpectedFoldingError
(line)[source]¶ Bases:
headerparser.errors.ScannerError
Raised when the scanner encounters a folded (indented) line that is not preceded by a valid header line
-
line
= None¶ The line containing the unexpected folding (indentation)
-