-
-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(miette): Add miette and derive Diagnostic for Error
- Loading branch information
Showing
2 changed files
with
5 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,17 @@ | ||
use miette::Diagnostic; | ||
use thiserror::Error; | ||
|
||
use crate::Integrity; | ||
|
||
/// Integrity-related error values. | ||
#[derive(Error, Debug, Clone, PartialEq, Eq)] | ||
#[derive(Diagnostic, Error, Debug, Clone, PartialEq, Eq)] | ||
pub enum Error { | ||
/// Error parsing an SRI string into an Integrity object. | ||
#[error("Failed to parse subresource integrity string: {0}")] | ||
#[diagnostic(code(ssri::parse_integrity_error), url(docsrs))] | ||
ParseIntegrityError(String), | ||
/// Error matching two Integrity values. | ||
#[error("Integrity check failed.\n\tWanted: {0}\n\tActual: {1}")] | ||
#[diagnostic(code(ssri::integrity_check_error), url(docsrs))] | ||
IntegrityCheckError(Integrity, Integrity), | ||
} |