diff --git a/scsh/scsh-condition.scm b/scsh/scsh-condition.scm index 145f8b7..038ab84 100644 --- a/scsh/scsh-condition.scm +++ b/scsh/scsh-condition.scm @@ -9,19 +9,26 @@ (define (errno-error errno syscall . stuff) (let ((msg (errno-msg errno))) - (apply signal 'syscall-error errno msg syscall stuff))) - + (apply (structure-ref exceptions signal-exception) + (enum op call-external-value) (enum exception os-error) + syscall errno msg stuff))) (define (with-errno-handler* handler thunk) (with-handler (lambda (condition more) - (if (syscall-error? condition) - (let ((stuff (condition-stuff condition))) - (handler (car stuff) ; errno - (cdr stuff)))) ; (msg syscall . packet) + (if (and (exception? condition) (eq? (exception-reason condition) + 'os-error)) + (let ((stuff (exception-arguments condition))) + (handler (cadr stuff) ; errno + (list (caddr stuff) ;msg + (car stuff) ;syscall + (cdddr stuff) ;packet + )))) ; (msg syscall . packet) (more)) thunk)) + + ;;; (with-errno-handler ;;; ((errno data) ; These are vars bound in this scope. ;;; ((errno/exist) . body1)