Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions crates/async-compression/src/generic/bufread/decoder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@ use crate::{
codecs::DecodeV2,
core::util::{PartialBuffer, WriteBuffer},
};
use std::{io::Result, ops::ControlFlow};
use std::{io::Result, ops::ControlFlow, panic::AssertUnwindSafe};

#[derive(Debug)]
enum State {
Decoding,
Flushing,
Done,
Next,
Error(std::io::Error),
Error(AssertUnwindSafe<std::io::Error>),
}

#[derive(Debug)]
Expand Down Expand Up @@ -55,7 +55,7 @@ impl Decoder {
// ignore the first error, occurs when input is empty
// but we need to run decode to flush
Err(err) if !first => {
self.state = State::Error(err);
self.state = State::Error(AssertUnwindSafe(err));
if output.written_len() > 0 {
return ControlFlow::Break(Ok(()));
} else {
Expand All @@ -73,7 +73,7 @@ impl Decoder {
Ok(true) => {
if self.multiple_members {
if let Err(err) = decoder.reinit() {
self.state = State::Error(err);
self.state = State::Error(AssertUnwindSafe(err));
if output.written_len() > 0 {
return ControlFlow::Break(Ok(()));
} else {
Expand All @@ -91,7 +91,7 @@ impl Decoder {
}
Ok(false) => State::Flushing,
Err(err) => {
self.state = State::Error(err);
self.state = State::Error(AssertUnwindSafe(err));
if output.written_len() > 0 {
return ControlFlow::Break(Ok(()));
} else {
Expand Down Expand Up @@ -119,7 +119,7 @@ impl Decoder {
let State::Error(err) = std::mem::replace(&mut self.state, State::Done) else {
unreachable!()
};
return ControlFlow::Break(Err(err));
return ControlFlow::Break(Err(err.0));
}
};

Expand Down
12 changes: 6 additions & 6 deletions crates/async-compression/src/generic/bufread/encoder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@ use crate::{
codecs::EncodeV2,
core::util::{PartialBuffer, WriteBuffer},
};
use std::{io::Result, ops::ControlFlow};
use std::{io::Result, ops::ControlFlow, panic::AssertUnwindSafe};

#[derive(Debug)]
enum State {
Encoding(usize),
Flushing,
Finishing,
Done,
Error(std::io::Error),
Error(AssertUnwindSafe<std::io::Error>),
}

#[derive(Debug)]
Expand Down Expand Up @@ -54,7 +54,7 @@ impl Encoder {
State::Finishing
} else {
if let Err(err) = encoder.encode(input, output) {
self.state = State::Error(err);
self.state = State::Error(AssertUnwindSafe(err));
if output.written_len() > 0 {
return ControlFlow::Break(Ok(()));
} else {
Expand All @@ -79,7 +79,7 @@ impl Encoder {
}
Ok(false) => State::Flushing,
Err(err) => {
self.state = State::Error(err);
self.state = State::Error(AssertUnwindSafe(err));
if output.written_len() > 0 {
return ControlFlow::Break(Ok(()));
} else {
Expand All @@ -92,7 +92,7 @@ impl Encoder {
Ok(true) => State::Done,
Ok(false) => State::Finishing,
Err(err) => {
self.state = State::Error(err);
self.state = State::Error(AssertUnwindSafe(err));
if output.written_len() > 0 {
return ControlFlow::Break(Ok(()));
} else {
Expand All @@ -107,7 +107,7 @@ impl Encoder {
let State::Error(err) = std::mem::replace(&mut self.state, State::Done) else {
unreachable!()
};
return ControlFlow::Break(Err(err));
return ControlFlow::Break(Err(err.0));
}
};

Expand Down