TheDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/avsm/httpz/llms.txt
Use this file to discover all available pages before exploring further.
Err module provides zero-cost abstractions for raising parse errors with various status codes. All functions are inlined for performance, making error handling both ergonomic and efficient.
Status Type
Parse status enumeration (re-exported from
Buf_read.status).Parsing completed successfully
Need more input data to continue parsing
HTTP method is invalid or unsupported
Request target (URI) is malformed
HTTP version is invalid or unsupported
Header name or value is malformed
Headers exceed maximum allowed size
General protocol format violation
Content-Length value exceeds maximum allowed
Both Content-Length and Transfer-Encoding present
Bare CR found (security violation)
Required Host header is missing (HTTP/1.1)
Transfer-Encoding other than chunked is not supported
Exception
Parse_error
Direct Fail Combinators
These functions immediately raise aParse_error with the specified status.
fail
Parse_error with the given status.
The error status to raise
partial
Parse_error Partial. Use when more input is needed.
Example:
malformed
Parse_error Malformed. Use for format violations.
Example:
Conditional Raises (when condition is TRUE)
These functions raise errors when the condition is true.when_
Parse_error status if condition is true.
Condition to check
The error status to raise if condition is true
partial_when
Parse_error Partial if condition is true.
Condition to check
malformed_when
Parse_error Malformed if condition is true.
Condition to check
Guard Combinators (raise when condition is FALSE)
These functions raise errors when the condition is false (i.e., they “guard” that the condition must be true).guard
Parse_error status if condition is false.
Condition that must be true
The error status to raise if condition is false
partial_unless
Parse_error Partial if condition is false.
Use for buffer boundary checks where you require more data.
Condition that must be true (enough data available)
malformed_unless
Parse_error Malformed if condition is false.
Use for validation checks where you require a condition to hold.
Condition that must be true (valid format)
Recovery Combinator
optional
Or_null.some. On Parse_error, restores state using restore (save ()) and returns Or_null.none.
Function to save current parser position/state
Function to restore parser position/state
Parser function to attempt