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#[derive(Debug, Clone, PartialEq, Eq, thiserror::Error)]
11pub enum PsError {
12    #[error("VMerror")]
13    VMError,
14    #[error("dictfull")]
15    DictFull,
16    #[error("dictstackoverflow")]
17    DictStackOverflow,
18    #[error("dictstackunderflow")]
19    DictStackUnderflow,
20    #[error("execstackoverflow")]
21    ExecStackOverflow,
22    #[error("invalidaccess")]
23    InvalidAccess,
24    #[error("invalidexit")]
25    InvalidExit,
26    #[error("invalidfileaccess")]
27    InvalidFileAccess,
28    #[error("invalidfont")]
29    InvalidFont,
30    #[error("invalidrestore")]
31    InvalidRestore,
32    #[error("ioerror")]
33    IOError,
34    #[error("limitcheck")]
35    LimitCheck,
36    #[error("nocurrentpoint")]
37    NoCurrentPoint,
38    #[error("rangecheck")]
39    RangeCheck,
40    #[error("stackoverflow")]
41    StackOverflow,
42    #[error("stackunderflow")]
43    StackUnderflow,
44    #[error("syntaxerror")]
45    SyntaxError,
46    #[error("timeout")]
47    Timeout,
48    #[error("typecheck")]
49    TypeCheck,
50    #[error("undefined")]
51    Undefined,
52    #[error("undefinedfilename")]
53    UndefinedFilename,
54    #[error("undefinedresource")]
55    UndefinedResource,
56    #[error("undefinedresult")]
57    UndefinedResult,
58    #[error("unmatchedmark")]
59    UnmatchedMark,
60    #[error("unregistered")]
61    Unregistered,
62    #[error("unsupported")]
63    Unsupported,
64    #[error("configurationerror")]
65    ConfigurationError,
66
67    // Internal control flow (not PostScript errors)
68    #[error("quit")]
69    Quit,
70    #[error("stop")]
71    Stop,
72    #[error("exit")]
73    Exit,
74}