diff options
-rw-r--r-- | l/src/main.lisp | 38 |
1 files changed, 22 insertions, 16 deletions
diff --git a/l/src/main.lisp b/l/src/main.lisp index fbe3357..d0ae602 100644 --- a/l/src/main.lisp +++ b/l/src/main.lisp @@ -19,22 +19,28 @@ :long "version")) (defun main () - (let ((config (parse-options))) - ;; Store the WebSocket client as a global. - (defvar *client* (ws-client config)) - - ;; TODO: error if no `socket-url` - (with-websocket-connection (*client*) - (wsd:on :message *client* - #'(lambda (message) - (ws-on-message message (extension-ids config)))) - ; (wsd:on :message *client* #'(lambda (message) (ws-on-message message))) - ;; TODO: Maybe defvar *config* and store client in the config - - (websocket-send *client* (target-get-targets-msg - (next-call-id *devtools-root-call-id*))) - - (wait-group:wait *wg*)))) + (handler-bind ((error + #'(lambda (e) + (format *error-output* "error: ~a~%" e) + + (opts:exit 69)))) + + (let ((config (parse-options))) + ;; Store the WebSocket client as a global. + (defvar *client* (ws-client config)) + + ;; TODO: error if no `socket-url` + (with-websocket-connection (*client*) + (wsd:on :message *client* + #'(lambda (message) + (ws-on-message message (extension-ids config)))) + ; (wsd:on :message *client* #'(lambda (message) (ws-on-message message))) + ;; TODO: Maybe defvar *config* and store client in the config + + (websocket-send *client* (target-get-targets-msg + (next-call-id *devtools-root-call-id*))) + + (wait-group:wait *wg*))))) (defun ws-on-message (message extension-ids) (let* ((response (jsown:parse message)) |