diff options
author | Valentin Popov <valentin@popov.link> | 2024-01-08 00:21:28 +0300 |
---|---|---|
committer | Valentin Popov <valentin@popov.link> | 2024-01-08 00:21:28 +0300 |
commit | 1b6a04ca5504955c571d1c97504fb45ea0befee4 (patch) | |
tree | 7579f518b23313e8a9748a88ab6173d5e030b227 /vendor/miette/src/error.rs | |
parent | 5ecd8cf2cba827454317368b68571df0d13d7842 (diff) | |
download | fparkan-1b6a04ca5504955c571d1c97504fb45ea0befee4.tar.xz fparkan-1b6a04ca5504955c571d1c97504fb45ea0befee4.zip |
Initial vendor packages
Signed-off-by: Valentin Popov <valentin@popov.link>
Diffstat (limited to 'vendor/miette/src/error.rs')
-rw-r--r-- | vendor/miette/src/error.rs | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/vendor/miette/src/error.rs b/vendor/miette/src/error.rs new file mode 100644 index 0000000..56041ca --- /dev/null +++ b/vendor/miette/src/error.rs @@ -0,0 +1,27 @@ +use std::io; + +use thiserror::Error; + +use crate::{self as miette, Diagnostic}; + +/** +Error enum for miette. Used by certain operations in the protocol. +*/ +#[derive(Debug, Diagnostic, Error)] +pub enum MietteError { + /// Wrapper around [`std::io::Error`]. This is returned when something went + /// wrong while reading a [`SourceCode`](crate::SourceCode). + #[error(transparent)] + #[diagnostic(code(miette::io_error), url(docsrs))] + IoError(#[from] io::Error), + + /// Returned when a [`SourceSpan`](crate::SourceSpan) extends beyond the + /// bounds of a given [`SourceCode`](crate::SourceCode). + #[error("The given offset is outside the bounds of its Source")] + #[diagnostic( + code(miette::span_out_of_bounds), + help("Double-check your spans. Do you have an off-by-one error?"), + url(docsrs) + )] + OutOfBounds, +} |