Changed the representation of scsh-conditions to the exception
os-error so it may be throwen from C.
This commit is contained in:
parent
27bafee1bc
commit
8ce0551795
|
@ -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)
|
||||
|
|
Loading…
Reference in New Issue