diff options
Diffstat (limited to 'l')
-rw-r--r-- | l/src/main.lisp | 7 | ||||
-rw-r--r-- | l/src/option.lisp | 7 |
2 files changed, 6 insertions, 8 deletions
diff --git a/l/src/main.lisp b/l/src/main.lisp index 22c1d07..770d88b 100644 --- a/l/src/main.lisp +++ b/l/src/main.lisp @@ -25,12 +25,7 @@ :long "version")) (defun main () - (handler-bind ((error - #'(lambda (e) - ;; TODO: generic function for this and `handle-option-error` - (format *error-output* "error: ~a~%" e) - - (opts:exit 69)))) + (handler-bind ((error #'(lambda (e) (exit-with-error e 69)))) (let ((config (parse-options))) ;; Store the WebSocket client as a global. diff --git a/l/src/option.lisp b/l/src/option.lisp index 14553a0..b666fa4 100644 --- a/l/src/option.lisp +++ b/l/src/option.lisp @@ -5,10 +5,13 @@ (when value ,@body))) -(defun handle-option-error (condition) +(defun exit-with-error (condition exit-code) (format *error-output* "error: ~a~%" condition) - (opts:exit 64)) + (opts:exit exit-code)) + +(defun handle-option-error (condition) + (exit-with-error condition 64)) (defun parse-options () (multiple-value-bind (options free-args) |