diff options
| -rw-r--r-- | jefs.fs | 8 | ||||
| -rw-r--r-- | readme.md | 2 |
2 files changed, 8 insertions, 2 deletions
@@ -194,7 +194,6 @@ variable hld \ FUCK is BYE but it takes an error code. its called that because you call it when shit is fucked. : fuck ( code -- ) 60 syscall1 ; -\ TODO broken as shit : (handler) >s0 error @ dup case 1 of ." stack underflow" endof 2 of ." word not found" endof @@ -217,6 +216,13 @@ variable hld 2 constant enoent 9 constant ebadf 13 constant eacces + +: .errno ( err -- ) ?dup 0<> if case + enoent of ." no such file or directory" endof + ebadf of ." bad file descriptor" endof + eacces of ." permission denied" endof + ." mystery error (spooky)" + endcase cr then ; \ }}} \ FILE I/O {{{ @@ -73,7 +73,7 @@ note that this forth doesn't have double numbers (i don't think it's necessary, since cells are 64 bit) so PNO works on single cell values. -### error codes +## error codes in order to have Good Error Handling anywhere, the error handler's xt is stored in the `handler` variable and is then called by loading its value and `execute`ing it. the actual description of the error comes from the |
