Skip to content

Add section warning against catching Throwables#264

Merged
bbatsov merged 1 commit intobbatsov:masterfrom
NoahTheDuke:nb/catching-throwables
Feb 16, 2026
Merged

Add section warning against catching Throwables#264
bbatsov merged 1 commit intobbatsov:masterfrom
NoahTheDuke:nb/catching-throwables

Conversation

@NoahTheDuke
Copy link
Contributor

@NoahTheDuke NoahTheDuke commented Jun 23, 2025

I've noticed that many Clojure programmers use (catch Throwable t ...) as a means of not dealing with Exceptions. However, this is poor Java practice given that Errors are generally treated as "the application should fail" situations. As such, I think it would be nice to have a recommendation against using (catch Throwable t ...) alongside a nudge towards using explicit Error and Exception classes in catch clauses.

cf: Blind Rescues in the Ruby Style Guide, the recommendation of the Java Docs on Errors.

@seancorfield
Copy link
Collaborator

I agree with the advice Noah wants to add here (even tho' I'm guilty of catching Throwable myself).

BTW, I've fixed the codespell failure on the main branch (ignore rouge).

@NoahTheDuke NoahTheDuke force-pushed the nb/catching-throwables branch from 51257cc to ee87d55 Compare July 15, 2025 17:36
@NoahTheDuke
Copy link
Contributor Author

I rebased on master to fix the spelling mistake.

@bbatsov bbatsov merged commit 98f14da into bbatsov:master Feb 16, 2026
2 checks passed
@bbatsov
Copy link
Owner

bbatsov commented Feb 16, 2026

Looks good to me as well. Sorry for the slow turnaround here.

@NoahTheDuke NoahTheDuke deleted the nb/catching-throwables branch February 16, 2026 12:15
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.

3 participants