diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/forth/vm.rs | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/forth/vm.rs b/src/forth/vm.rs index a4f57c7..e4c01f2 100644 --- a/src/forth/vm.rs +++ b/src/forth/vm.rs @@ -114,6 +114,14 @@ pub struct VM { pub enum RuntimeError { StackUnderflow, } +impl std::fmt::Display for RuntimeError { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + match self { + Self::StackUnderflow => write!(f, "stack underflow"), + } + } +} +impl std::error::Error for RuntimeError {} impl VM { pub fn new(wordlist: WordList) -> Self { |
