inferior: Raise '&inferior-protocol-error' on invalid response.
* guix/inferior.scm (&inferior-protocol-error): New condition type. (read-repl-response): Add default 'match' clause and raise it.
parent
47ba3f7d25
commit
60bea07593
|
@ -69,6 +69,8 @@
|
||||||
inferior-exception-arguments
|
inferior-exception-arguments
|
||||||
inferior-exception-inferior
|
inferior-exception-inferior
|
||||||
inferior-exception-stack
|
inferior-exception-stack
|
||||||
|
inferior-protocol-error?
|
||||||
|
inferior-protocol-error-inferior
|
||||||
read-repl-response
|
read-repl-response
|
||||||
|
|
||||||
inferior-packages
|
inferior-packages
|
||||||
|
@ -314,6 +316,10 @@ equivalent. Return #f if the inferior could not be launched."
|
||||||
(inferior inferior-exception-inferior) ;<inferior> | #f
|
(inferior inferior-exception-inferior) ;<inferior> | #f
|
||||||
(stack inferior-exception-stack)) ;list of (FILE COLUMN LINE)
|
(stack inferior-exception-stack)) ;list of (FILE COLUMN LINE)
|
||||||
|
|
||||||
|
(define-condition-type &inferior-protocol-error &error
|
||||||
|
inferior-protocol-error?
|
||||||
|
(inferior inferior-protocol-error-inferior)) ;<inferior>
|
||||||
|
|
||||||
(define* (read-repl-response port #:optional inferior)
|
(define* (read-repl-response port #:optional inferior)
|
||||||
"Read a (guix repl) response from PORT and return it as a Scheme object.
|
"Read a (guix repl) response from PORT and return it as a Scheme object.
|
||||||
Raise '&inferior-exception' when an exception is read from PORT."
|
Raise '&inferior-exception' when an exception is read from PORT."
|
||||||
|
@ -339,7 +345,11 @@ Raise '&inferior-exception' when an exception is read from PORT."
|
||||||
(raise (condition (&inferior-exception
|
(raise (condition (&inferior-exception
|
||||||
(arguments (cons key (map sexp->object objects)))
|
(arguments (cons key (map sexp->object objects)))
|
||||||
(inferior inferior)
|
(inferior inferior)
|
||||||
(stack '())))))))
|
(stack '())))))
|
||||||
|
(_
|
||||||
|
;; Protocol error.
|
||||||
|
(raise (condition (&inferior-protocol-error
|
||||||
|
(inferior inferior)))))))
|
||||||
|
|
||||||
(define (read-inferior-response inferior)
|
(define (read-inferior-response inferior)
|
||||||
(read-repl-response (inferior-socket inferior)
|
(read-repl-response (inferior-socket inferior)
|
||||||
|
|
Reference in New Issue