mirror of
https://git.in.rschanz.org/ryan77627/guix.git
synced 2024-12-24 21:38:07 -05:00
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.
This commit is contained in:
parent
47ba3f7d25
commit
60bea07593
1 changed files with 11 additions and 1 deletions
|
@ -69,6 +69,8 @@ (define-module (guix inferior)
|
|||
inferior-exception-arguments
|
||||
inferior-exception-inferior
|
||||
inferior-exception-stack
|
||||
inferior-protocol-error?
|
||||
inferior-protocol-error-inferior
|
||||
read-repl-response
|
||||
|
||||
inferior-packages
|
||||
|
@ -314,6 +316,10 @@ (define-condition-type &inferior-exception &error
|
|||
(inferior inferior-exception-inferior) ;<inferior> | #f
|
||||
(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)
|
||||
"Read a (guix repl) response from PORT and return it as a Scheme object.
|
||||
Raise '&inferior-exception' when an exception is read from PORT."
|
||||
|
@ -339,7 +345,11 @@ (define sexp->object
|
|||
(raise (condition (&inferior-exception
|
||||
(arguments (cons key (map sexp->object objects)))
|
||||
(inferior inferior)
|
||||
(stack '())))))))
|
||||
(stack '())))))
|
||||
(_
|
||||
;; Protocol error.
|
||||
(raise (condition (&inferior-protocol-error
|
||||
(inferior inferior)))))))
|
||||
|
||||
(define (read-inferior-response inferior)
|
||||
(read-repl-response (inferior-socket inferior)
|
||||
|
|
Loading…
Reference in a new issue