diff options
| author | kitty <nepeta@canaglie.net> | 2026-02-27 03:19:31 +1100 |
|---|---|---|
| committer | kitty <nepeta@canaglie.net> | 2026-02-27 03:19:31 +1100 |
| commit | 246f0e1948c2dbc97965820bc2367d2cef704ed5 (patch) | |
| tree | 5e1140f05b193b3624ce49d73c707e786179ea06 | |
| parent | 68c945a5fa5dc53b0f7cb225c18a7c6029e44e3c (diff) | |
.errno
i should go to bed
| -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 |
