actpub_activitystreams/error.rs
1//! Error types for [`actpub-activitystreams`](crate).
2
3use thiserror::Error;
4
5/// Errors that can arise when parsing or constructing Activity Streams values.
6#[derive(Debug, Error)]
7#[non_exhaustive]
8pub enum Error {
9 /// A URL-valued property could not be parsed as a valid URL.
10 #[error("invalid URL: {0}")]
11 InvalidUrl(#[from] url::ParseError),
12
13 /// A `mediaType` property was not a valid MIME type.
14 #[error("invalid media type: {0}")]
15 InvalidMediaType(#[from] mime::FromStrError),
16
17 /// An error occurred during JSON (de)serialization.
18 #[error("JSON error: {0}")]
19 Json(#[from] serde_json::Error),
20}