Skip to main content

klayout_core/
error.rs

1//! Error types. Every error carries the cell context where possible so that
2//! sign-off-grade reports can be assembled without losing provenance.
3
4use crate::cell::CellName;
5use crate::coord::Point;
6use crate::layer::LayerInfo;
7
8pub type Result<T> = std::result::Result<T, CoreError>;
9
10#[derive(Debug, thiserror::Error)]
11pub enum CoreError {
12    #[error("off-grid coordinate {coord:?} (manufacturing grid = {grid}) in cell {cell}")]
13    OffGrid {
14        coord: Point,
15        grid: i64,
16        cell: CellName,
17    },
18
19    #[error("unknown layer {0:?}")]
20    UnknownLayer(LayerInfo),
21
22    #[error("unknown cell id {0:?}")]
23    UnknownCell(u32),
24
25    #[error("port name collision: {name} already exists in cell {cell}")]
26    PortCollision { name: String, cell: CellName },
27
28    #[error("library mismatch: {detail}")]
29    LibraryMismatch { detail: String },
30}