Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

handle ex #24

Closed
wants to merge 1 commit into from
Closed

handle ex #24

wants to merge 1 commit into from

Conversation

darkleaf
Copy link
Owner

Closes #15

@@ -131,12 +131,16 @@
[nil :required] (missing-dependency! stack)
(recur tail (assoc built-map key obj)))))))))

(defn- try-run [proc]
(defn- handle-ex [proc handler]
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@KGOH @krevedkokun it seems ugly for me. Do you know any other solution?
In Java we should not catch Errors, but in Clojure I want to catch and recover on AssertionError.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(defn- try-run [proc]
  (try (proc)
       nil
       (catch Exception e e)
       (catch AssertionError e e)))

(defn- try-build [ctx key]
  (try (build ctx key)
       (catch Exception e e (??? e))
       (catch AssertionError e e (??? e))))

darkleaf added a commit that referenced this pull request Dec 30, 2024
@darkleaf darkleaf marked this pull request as ready for review January 6, 2025 15:04
@darkleaf darkleaf closed this Jan 6, 2025
@darkleaf darkleaf deleted the handle-ex branch January 6, 2025 15:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Don't catch Throwable
2 participants