Skip to content

Commit

Permalink
[toimage] box source errors to use less stack space
Browse files Browse the repository at this point in the history
  • Loading branch information
Enet4 committed Sep 18, 2023
1 parent f9a8438 commit 6b0e35c
Showing 1 changed file with 14 additions and 5 deletions.
19 changes: 14 additions & 5 deletions toimage/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,27 +51,36 @@ struct App {
enum Error {
#[snafu(display("could not read DICOM file {}", path.display()))]
ReadFile {
source: dicom_object::ReadError,
#[snafu(source(from(dicom_object::ReadError, Box::new)))]
source: Box<dicom_object::ReadError>,
path: PathBuf,
},
/// failed to decode pixel data
DecodePixelData { source: dicom_pixeldata::Error },
DecodePixelData {
#[snafu(source(from(dicom_pixeldata::Error, Box::new)))]
source: Box<dicom_pixeldata::Error>,
},
/// missing offset table entry for frame #{frame_number}
MissingOffsetEntry { frame_number: u32 },
/// missing key property {name}
MissingProperty { name: &'static str },
/// property {name} contains an invalid value
InvalidPropertyValue {
name: &'static str,
source: dicom_core::value::ConvertValueError,
#[snafu(source(from(dicom_core::value::ConvertValueError, Box::new)))]
source: Box<dicom_core::value::ConvertValueError>,
},
/// pixel data of frame #{frame_number} is out of bounds
FrameOutOfBounds { frame_number: u32 },
/// failed to convert pixel data to image
ConvertImage { source: dicom_pixeldata::Error },
ConvertImage {
#[snafu(source(from(dicom_pixeldata::Error, Box::new)))]
source: Box<dicom_pixeldata::Error>,
},
/// failed to save image to file
SaveImage {
source: dicom_pixeldata::image::ImageError,
#[snafu(source(from(dicom_pixeldata::image::ImageError, Box::new)))]
source: Box<dicom_pixeldata::image::ImageError>,
},
/// failed to save pixel data to file
SaveData { source: std::io::Error },
Expand Down

0 comments on commit 6b0e35c

Please sign in to comment.