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
//! Error types for the Altium library.
use thiserror::Error;
/// Main error type for Altium file operations.
#[derive(Error, Debug)]
pub enum AltiumError {
/// I/O error when reading/writing files.
#[error("I/O error: {0}")]
Io(#[from] std::io::Error),
/// Invalid parameter format.
#[error("Invalid parameter format: {0}")]
InvalidParameter(String),
/// Invalid coordinate format.
#[error("Invalid coordinate format: {0}")]
InvalidCoordinate(String),
/// Invalid unit format.
#[error("Invalid unit: {0}")]
InvalidUnit(String),
/// Invalid layer.
#[error("Invalid layer: {0}")]
InvalidLayer(String),
/// Invalid record type.
#[error("Invalid record type: {0}")]
InvalidRecord(String),
/// Missing required data.
#[error("Missing required data: {0}")]
MissingData(String),
/// Decompression error (zlib).
#[error("Decompression error: {0}")]
Decompression(String),
/// Encoding error (Windows-1252 or UTF-8).
#[error("Encoding error: {0}")]
Encoding(String),
/// Unexpected end of stream.
#[error("Unexpected end of stream")]
UnexpectedEof,
/// Generic parse error.
#[error("Parse error: {0}")]
Parse(String),
/// Validation error for invalid data values.
#[error("Validation error: {0}")]
Validation(String),
}
/// Result type alias for Altium operations.
pub type Result<T> = std::result::Result<T, AltiumError>;