Public declaration syntax from forge-rs/crates/forge-web/src/error.rs Original source SHA-256: f1cf0da76c9cc6f04ff91e055e5f1dd883b84e94c77a565c6e244857e0cc911d Function bodies and constant values are omitted. This is not the complete implementation. Source line 26 #[derive(Debug, Error)] pub enum WebError { /// An HTTP fetch operation failed. /// /// This covers network errors, DNS resolution failures, TLS handshake /// failures, and other transport-level problems. #[error("fetch failed for '{url}': {reason}")] FetchFailed { /// The URL that was being fetched. url: String, /// What went wrong during the fetch. reason: String, }, /// HTML or document parsing failed. /// /// Returned when the web content cannot be parsed into the expected /// structured format or does not satisfy the operation's parser contract. #[error("parse failed for '{url}': {reason}")] ParseFailed { /// The URL whose content could not be parsed. url: String, /// What went wrong during parsing. reason: String, }, /// Content extraction failed. /// /// Returned when a CSS selector, XPath, or JSONPath query cannot be /// executed against the parsed content. #[error("extraction failed for query '{query}' on '{url}': {reason}")] ExtractionFailed { /// The URL whose content was being queried. url: String, /// The extraction query that failed. query: String, /// What went wrong during extraction. reason: String, }, /// A web search operation failed. /// /// Returned when a search query cannot be validated, a search endpoint /// cannot be queried, or the response cannot be parsed into results. #[error("search failed for query '{query}': {reason}")] SearchFailed { /// The search query. query: String, /// What went wrong during the search. reason: String, }, /// A fetch was blocked because the resolved IP address falls within a /// private, loopback, or link-local range (SSRF protection). /// /// This is a security control. The blocked IP ranges are configured via /// [`WebSubstrateConfig::blocked_ip_ranges`](crate::config::WebSubstrateConfig). #[error( "SSRF blocked: '{url}' resolved to blocked IP {ip} (private/loopback/link-local range)" )] SsrfBlocked { /// The URL that was being fetched. url: String, /// The IP address that triggered the block. ip: String, }, /// The maximum number of HTTP redirects was exceeded. /// /// Configure the limit via /// [`WebSubstrateConfig::max_redirects`](crate::config::WebSubstrateConfig). #[error("redirect limit exceeded for '{url}': followed {count} redirects (max {max})")] RedirectLimitExceeded { /// The original URL that was being fetched. url: String, /// The number of redirects followed before the limit was hit. count: u32, /// The configured maximum number of redirects. max: u32, }, /// The response body exceeds the configured maximum size. /// /// Configure the limit via /// [`WebSubstrateConfig::max_fetch_size_bytes`](crate::config::WebSubstrateConfig). #[error( "content too large for '{url}': response size {size} bytes exceeds limit of {max} bytes" )] ContentTooLarge { /// The URL whose response was too large. url: String, /// The actual (or estimated) response size in bytes. size: u64, /// The configured maximum size in bytes. max: u64, }, /// The provided URL is invalid or cannot be parsed. /// /// Check that the URL includes a scheme (`http://` or `https://`), /// a valid host, and well-formed path components. #[error("invalid URL '{url}': {reason}")] InvalidUrl { /// The URL string that failed validation. url: String, /// What is wrong with the URL. reason: String, }, /// The HTTP request timed out. /// /// Configure the timeout via /// [`WebSubstrateConfig::request_timeout_ms`](crate::config::WebSubstrateConfig). #[error("request timed out for '{url}' after {timeout_ms}ms")] Timeout { /// The URL that timed out. url: String, /// The configured timeout in milliseconds. timeout_ms: u64, }, /// A boundary contract denied the operation. /// /// This occurs when the web substrate detects a security policy violation /// such as a cross-scheme redirect downgrade (HTTPS to HTTP). #[error("boundary contract denied for '{url}': {reason}")] BoundaryContractDenied { /// The URL involved in the denied operation. url: String, /// Why the boundary contract was violated. reason: String, }, } Source line 160 pub type WebResult = Result;