Created
March 9, 2021 08:42
-
-
Save Kah0ona/a6088406d122df4ed5f7fbf0c3afe91c to your computer and use it in GitHub Desktop.
catching asserts inside a future body fails silently, but why?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(future | |
(try | |
(println "inside future body") | |
(assert false) ;; | |
(catch Exception e | |
(println "error" (.getMessage e))))) ;; no error printed | |
(try ;; not in a future, but just normal | |
(println "inside future body") | |
(assert false) ;; | |
(catch Exception e | |
(println "error" (.getMessage e)))) ;; error printed | |
(future | |
(try | |
(println "inside future body") | |
(throw (ex-info "throwing" {})) | |
(catch Exception e | |
(println "error" (.getMessage e))))) ;; error printed | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment