Skip to content

Instantly share code, notes, and snippets.

@Kah0ona
Created March 9, 2021 08:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Kah0ona/a6088406d122df4ed5f7fbf0c3afe91c to your computer and use it in GitHub Desktop.
Save Kah0ona/a6088406d122df4ed5f7fbf0c3afe91c to your computer and use it in GitHub Desktop.
catching asserts inside a future body fails silently, but why?
(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