1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
use std::path::PathBuf;
/// Error type returned by public `wsi-dicom` APIs.
#[derive(Debug, thiserror::Error)]
#[non_exhaustive]
pub enum Error {
/// Export or validation options are internally inconsistent.
#[error("invalid DICOM export options: {reason}")]
InvalidOptions {
/// Human-readable reason safe to show to users.
reason: String,
},
/// Metadata is missing required fields or cannot be mapped safely.
#[error("invalid DICOM metadata: {reason}")]
Metadata {
/// Human-readable reason safe to show to users.
reason: String,
},
/// Source or prepared pixel data cannot be represented by the requested output.
#[error("unsupported pixel data: {reason}")]
UnsupportedPixelData {
/// Human-readable reason safe to show to users.
reason: String,
},
/// The requested route, transfer syntax, or backend is unsupported.
#[error("unsupported export request: {reason}")]
Unsupported {
/// Human-readable reason safe to show to users.
reason: String,
},
/// The source slide could not be opened.
#[error("failed to open source slide {path}: {message}")]
SourceOpen {
/// Source path that failed to open.
path: PathBuf,
/// Underlying open error message.
message: String,
},
/// DICOM export identity generation failed.
#[error("failed to generate DICOM export identity: {reason}")]
Identity {
/// Human-readable identity generation failure.
reason: String,
},
/// The source slide failed while reading pixels or metadata.
#[error("slide read failed: {message}")]
SlideRead {
/// Underlying read error message.
message: String,
},
/// JPEG 2000 or HTJ2K encoding failed before a frame location was available.
#[error("JPEG 2000 encode failed: {message}")]
Encode {
/// Underlying encode error message.
message: String,
},
/// JPEG 2000 or HTJ2K encoding failed for one DICOM frame.
#[error(
"JPEG 2000 encode failed at level {level}, tile row {row}, tile column {col}: {message}"
)]
FrameEncode {
/// Source pyramid level being encoded.
level: u32,
/// DICOM tile row being encoded.
row: u64,
/// DICOM tile column being encoded.
col: u64,
/// Underlying encode error message.
message: String,
},
/// Filesystem I/O failed at a known path.
#[error("I/O error at {path}: {source}")]
Io {
/// Path involved in the failed I/O operation.
path: PathBuf,
/// Underlying I/O error.
source: std::io::Error,
},
/// DICOM object construction or writing failed.
#[error("DICOM write failed for {path}: {message}")]
DicomWrite {
/// Destination path being written.
path: PathBuf,
/// Underlying DICOM writer message.
message: String,
},
/// JSON parsing failed at a known path.
#[error("JSON parse failed for {path}: {source}")]
Json {
/// JSON path being read.
path: PathBuf,
/// Underlying JSON parser error.
source: serde_json::Error,
},
/// JSON serialization failed.
#[error("JSON serialization failed: {message}")]
JsonSerialize {
/// Serialization error message.
message: String,
},
/// A staged export could not be committed or rolled back completely.
#[error("export transaction requires recovery at {recovery_path}: {reason}")]
ExportTransaction {
/// Directory containing the durable manifest, staged files, and backups.
recovery_path: PathBuf,
/// Human-readable commit or rollback failure details.
reason: String,
},
/// External DICOM validation failed.
#[error("DICOM validation failed: {reason}")]
Validation {
/// Human-readable validation failure reason.
reason: String,
},
}