Skip to content

Commit

Permalink
Rename ErrorWithStacktrace to TestError
Browse files Browse the repository at this point in the history
Signed-off-by: Wiktor Kwapisiewicz <wiktor@metacode.biz>
  • Loading branch information
wiktor-k committed Jan 16, 2023
1 parent f487252 commit 9ee18da
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@
/// This type is useful only in the result of unit tests and cannot be instantiated.
#[derive(Debug)]
#[doc(hidden)]
pub enum ErrorWithStacktrace {}
pub enum TestError {}

impl<T: std::fmt::Display> From<T> for ErrorWithStacktrace {
impl<T: std::fmt::Display> From<T> for TestError {
#[track_caller] // Will show the location of the caller in test failure messages
fn from(error: T) -> Self {
panic!("error: {} - {}", std::any::type_name::<T>(), error);
Expand All @@ -39,8 +39,7 @@ impl<T: std::fmt::Display> From<T> for ErrorWithStacktrace {
/// Ok(())
/// }
/// ```

pub type TestResult = std::result::Result<(), ErrorWithStacktrace>;
pub type TestResult = std::result::Result<(), TestError>;

#[cfg(test)]
mod tests {
Expand Down

0 comments on commit 9ee18da

Please sign in to comment.