Compare commits
2 Commits
34c60ffb98
...
v0.7.3
Author | SHA1 | Date | |
---|---|---|---|
a16bee8e37 | |||
a61f00a79d
|
@@ -6,6 +6,14 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||||||
|
|
||||||
## [Unreleased]
|
## [Unreleased]
|
||||||
|
|
||||||
|
## [0.7.3] - 2025-07-24
|
||||||
|
|
||||||
|
### Added
|
||||||
|
- automatic conversion from anyhow::Error and access to aggregate errors
|
||||||
|
|
||||||
|
### Fixed
|
||||||
|
- *(deps)* update all dependencies (#30)
|
||||||
|
|
||||||
## [0.7.2] - 2025-06-25
|
## [0.7.2] - 2025-06-25
|
||||||
|
|
||||||
### Added
|
### Added
|
||||||
|
@@ -3,7 +3,7 @@ members = ["crates/*"]
|
|||||||
resolver = "2"
|
resolver = "2"
|
||||||
|
|
||||||
[workspace.package]
|
[workspace.package]
|
||||||
version = "0.7.2"
|
version = "0.7.3"
|
||||||
|
|
||||||
[workspace.dependencies]
|
[workspace.dependencies]
|
||||||
mad = { path = "crates/mad" }
|
mad = { path = "crates/mad" }
|
||||||
|
@@ -30,11 +30,23 @@ pub enum MadError {
|
|||||||
CloseNotDefined,
|
CloseNotDefined,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl From<anyhow::Error> for MadError {
|
||||||
|
fn from(value: anyhow::Error) -> Self {
|
||||||
|
Self::Inner(value)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
pub struct AggregateError {
|
pub struct AggregateError {
|
||||||
errors: Vec<MadError>,
|
errors: Vec<MadError>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl AggregateError {
|
||||||
|
pub fn get_errors(&self) -> &[MadError] {
|
||||||
|
&self.errors
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
impl Display for AggregateError {
|
impl Display for AggregateError {
|
||||||
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
||||||
f.write_str("MadError::AggregateError: (")?;
|
f.write_str("MadError::AggregateError: (")?;
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
|
|
||||||
use async_trait::async_trait;
|
use async_trait::async_trait;
|
||||||
use notmad::{Component, Mad};
|
use notmad::{Component, Mad, MadError};
|
||||||
use rand::Rng;
|
use rand::Rng;
|
||||||
use tokio::sync::Mutex;
|
use tokio::sync::Mutex;
|
||||||
use tokio_util::sync::CancellationToken;
|
use tokio_util::sync::CancellationToken;
|
||||||
@@ -137,3 +137,20 @@ async fn test_can_shutdown_gracefully() -> anyhow::Result<()> {
|
|||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn test_can_easily_transform_error() -> anyhow::Result<()> {
|
||||||
|
fn fallible() -> anyhow::Result<()> {
|
||||||
|
Ok(())
|
||||||
|
}
|
||||||
|
|
||||||
|
fn inner() -> Result<(), MadError> {
|
||||||
|
fallible()?;
|
||||||
|
|
||||||
|
Ok(())
|
||||||
|
}
|
||||||
|
|
||||||
|
inner()?;
|
||||||
|
|
||||||
|
Ok(())
|
||||||
|
}
|
||||||
|
Reference in New Issue
Block a user