Compare commits
1 Commits
v0.7.4
...
0633bfe7ca
Author | SHA1 | Date | |
---|---|---|---|
0633bfe7ca |
13
CHANGELOG.md
13
CHANGELOG.md
@@ -6,19 +6,6 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
||||
|
||||
## [Unreleased]
|
||||
|
||||
## [0.7.4] - 2025-07-24
|
||||
|
||||
### Added
|
||||
- cleanup aggregate error for single error
|
||||
|
||||
## [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
|
||||
|
||||
### Added
|
||||
|
15
Cargo.lock
generated
15
Cargo.lock
generated
@@ -34,9 +34,9 @@ checksum = "e16d2d3311acee920a9eb8d33b8cbc1787ce4a264e85f964c2404b969bdcd487"
|
||||
|
||||
[[package]]
|
||||
name = "async-trait"
|
||||
version = "0.1.88"
|
||||
version = "0.1.87"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e539d3fca749fcee5236ab05e93a52867dd549cc157c8cb7f99595f3cedffdb5"
|
||||
checksum = "d556ec1359574147ec0c4fc5eb525f3f23263a592b1a9c07e0a75b427de55c97"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
@@ -278,7 +278,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "notmad"
|
||||
version = "0.7.3"
|
||||
version = "0.7.2"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"async-trait",
|
||||
@@ -388,12 +388,13 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "rand"
|
||||
version = "0.9.2"
|
||||
version = "0.9.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "6db2770f06117d490610c7488547d543617b21bfa07796d7a12f6f1bd53850d1"
|
||||
checksum = "3779b94aeb87e8bd4e834cee3650289ee9e0d5677f976ecdb6d219e5f4f6cd94"
|
||||
dependencies = [
|
||||
"rand_chacha",
|
||||
"rand_core",
|
||||
"zerocopy 0.8.14",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -598,9 +599,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "tokio-util"
|
||||
version = "0.7.15"
|
||||
version = "0.7.13"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "66a539a9ad6d5d281510d5bd368c973d636c02dbf8a67300bfb6b950696ad7df"
|
||||
checksum = "d7fcaa8d55a2bdd6b83ace262b016eca0d79ee02818c5c1bcdf0305114081078"
|
||||
dependencies = [
|
||||
"bytes",
|
||||
"futures-core",
|
||||
|
@@ -3,7 +3,7 @@ members = ["crates/*"]
|
||||
resolver = "2"
|
||||
|
||||
[workspace.package]
|
||||
version = "0.7.4"
|
||||
version = "0.7.2"
|
||||
|
||||
[workspace.dependencies]
|
||||
mad = { path = "crates/mad" }
|
||||
|
@@ -30,33 +30,13 @@ pub enum MadError {
|
||||
CloseNotDefined,
|
||||
}
|
||||
|
||||
impl From<anyhow::Error> for MadError {
|
||||
fn from(value: anyhow::Error) -> Self {
|
||||
Self::Inner(value)
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug)]
|
||||
pub struct AggregateError {
|
||||
errors: Vec<MadError>,
|
||||
}
|
||||
|
||||
impl AggregateError {
|
||||
pub fn get_errors(&self) -> &[MadError] {
|
||||
&self.errors
|
||||
}
|
||||
}
|
||||
|
||||
impl Display for AggregateError {
|
||||
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
||||
if self.errors.is_empty() {
|
||||
return Ok(());
|
||||
}
|
||||
|
||||
if self.errors.len() == 1 {
|
||||
return f.write_str(&self.errors.first().unwrap().to_string());
|
||||
}
|
||||
|
||||
f.write_str("MadError::AggregateError: (")?;
|
||||
|
||||
for error in &self.errors {
|
||||
|
@@ -1,7 +1,7 @@
|
||||
use std::sync::Arc;
|
||||
|
||||
use async_trait::async_trait;
|
||||
use notmad::{Component, Mad, MadError};
|
||||
use notmad::{Component, Mad};
|
||||
use rand::Rng;
|
||||
use tokio::sync::Mutex;
|
||||
use tokio_util::sync::CancellationToken;
|
||||
@@ -137,20 +137,3 @@ async fn test_can_shutdown_gracefully() -> anyhow::Result<()> {
|
||||
|
||||
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