FeedFailure

abstract class FeedFailure : HttpFailure(source)

A failure of a feed document: the exchange and the policy were fine, the bytes were not a feed this module will read. Returned by a FeedParser and by FeedFetcher.fetch inside a Result.

Experimental (subclass). Subclassing needs @OptIn(ExperimentalForInheritanceWebToolsApi::class); creating a leaf, catching, matching and reading one are Stable Core. The leaves NotAFeed, Malformed, Refused and LimitExceeded are final with public constructors, so a parser of your own creates them. Match the leaves you care about and keep an else: new leaves may be added in a feature release.

Every message is constant text plus a reason's name; it never holds document content, a header value or a URL, and a leaf never carries a cause. Equality is identity.

Inheritors

Types

Link copied to clipboard
class LimitExceeded(val limit: FeedLimit) : FeedFailure

The document exceeds a FeedLimits bound that fails the parse.

Link copied to clipboard

The document is not well-formed XML, or the parser rejected it for a reason that is not one of the others.

Link copied to clipboard
class NotAFeed(val reason: NotAFeedReason) : FeedFailure

The document is well-formed or empty or something else, but not a feed.

Link copied to clipboard
class Refused(val reason: FeedRefusal) : FeedFailure

The document was refused before or while it was read: it carries a DOCTYPE, or its prolog cannot be read the way the parser reads it.

Properties

Link copied to clipboard
open val cause: Throwable?
Link copied to clipboard
open val message: String?