Skip to main content

stet_core/
error.rs

1// stet - A PostScript Interpreter
2// Copyright (c) 2026 Scott Bowman
3// SPDX-License-Identifier: Apache-2.0 OR MIT
4
5//! PostScript error types.
6//!
7//! All PLRM-defined errors plus internal control flow signals.
8
9/// PostScript error codes and internal control flow signals.
10///
11/// Marked `#[non_exhaustive]` so future PLRM-derived error variants
12/// (or new internal control-flow signals) can land additively;
13/// embedders that pattern-match for friendly error reporting must
14/// include a wildcard arm.
15#[derive(Debug, Clone, PartialEq, Eq, thiserror::Error)]
16#[non_exhaustive]
17pub enum PsError {
18    #[error("VMerror")]
19    VMError,
20    #[error("dictfull")]
21    DictFull,
22    #[error("dictstackoverflow")]
23    DictStackOverflow,
24    #[error("dictstackunderflow")]
25    DictStackUnderflow,
26    #[error("execstackoverflow")]
27    ExecStackOverflow,
28    #[error("invalidaccess")]
29    InvalidAccess,
30    #[error("invalidexit")]
31    InvalidExit,
32    #[error("invalidfileaccess")]
33    InvalidFileAccess,
34    #[error("invalidfont")]
35    InvalidFont,
36    #[error("invalidrestore")]
37    InvalidRestore,
38    #[error("ioerror")]
39    IOError,
40    #[error("limitcheck")]
41    LimitCheck,
42    #[error("nocurrentpoint")]
43    NoCurrentPoint,
44    #[error("rangecheck")]
45    RangeCheck,
46    #[error("stackoverflow")]
47    StackOverflow,
48    #[error("stackunderflow")]
49    StackUnderflow,
50    #[error("syntaxerror")]
51    SyntaxError,
52    #[error("timeout")]
53    Timeout,
54    #[error("typecheck")]
55    TypeCheck,
56    #[error("undefined")]
57    Undefined,
58    #[error("undefinedfilename")]
59    UndefinedFilename,
60    #[error("undefinedresource")]
61    UndefinedResource,
62    #[error("undefinedresult")]
63    UndefinedResult,
64    #[error("unmatchedmark")]
65    UnmatchedMark,
66    #[error("unregistered")]
67    Unregistered,
68    #[error("unsupported")]
69    Unsupported,
70    #[error("configurationerror")]
71    ConfigurationError,
72
73    // Internal control flow (not PostScript errors)
74    #[error("quit")]
75    Quit,
76    #[error("stop")]
77    Stop,
78    #[error("exit")]
79    Exit,
80}