[#1116] Missing error message when exception happens in REPL print

This commit is contained in:
Michiel Borkent 2021-12-29 16:10:30 +01:00
parent 818f2a9931
commit ddf03c50ae
2 changed files with 9 additions and 5 deletions

View file

@ -104,10 +104,12 @@ by default when a new command-line REPL is started."} repl-requires
(set! *3 *2) (set! *3 *2)
(set! *2 *1) (set! *2 *1)
(set! *1 value) (set! *1 value)
(try (try (print value)
(print value) (catch Throwable e
(catch Throwable e (throw (ex-info (ex-message e)
(throw (ex-info nil {:clojure.error/phase :print-eval-result} e))))))) (assoc (meta input)
:file "<repl>"
:type :sci/error) e)))))))
(catch Throwable e (catch Throwable e
(caught e) (caught e)
(set! *e e))))] (set! *e e))))]

View file

@ -50,7 +50,9 @@
(assert-repl "(read-line)hello" "hello") (assert-repl "(read-line)hello" "hello")
(assert-repl "(read-line)\nhello" "hello") (assert-repl "(read-line)\nhello" "hello")
(assert-repl-error "(+ 1 nil)" "NullPointerException") (assert-repl-error "(+ 1 nil)" "NullPointerException")
(assert-repl-error "(/ 1 0) (pst 1)" "Divide by zero\n\tclojure.lang.Numbers")) (assert-repl-error "(/ 1 0) (pst 1)" "Divide by zero\n\tclojure.lang.Numbers")
(assert-repl-error "(partition (range 5) 3)"
"Don't know how to create ISeq from: java.lang.Long"))
;;;; Scratch ;;;; Scratch