Skip to content

Commit

Permalink
chore: add error severity fn helpers (#48)
Browse files Browse the repository at this point in the history
  • Loading branch information
mattsse authored Jan 20, 2024
1 parent 6528e4a commit b6cbee1
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions src/artifacts/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,23 @@ pub struct Error {
pub formatted_message: Option<String>,
}

impl Error {
/// Returns `true` if the error is an error.
pub const fn is_error(&self) -> bool {
self.severity.is_error()
}

/// Returns `true` if the error is a warning.
pub const fn is_warning(&self) -> bool {
self.severity.is_warning()
}

/// Returns `true` if the error is an info.
pub const fn is_info(&self) -> bool {
self.severity.is_info()
}
}

/// Tries to mimic Solidity's own error formatting.
///
/// <https://github.com/ethereum/solidity/blob/a297a687261a1c634551b1dac0e36d4573c19afe/liblangutil/SourceReferenceFormatter.cpp#L105>
Expand Down

0 comments on commit b6cbee1

Please sign in to comment.