You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@ozone.apache.org by "Siyao Meng (Jira)" <ji...@apache.org> on 2025/07/18 22:19:00 UTC
[jira] [Updated] (HDDS-13471) Reconsider catching Throwable
[ https://issues.apache.org/jira/browse/HDDS-13471?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Siyao Meng updated HDDS-13471:
------------------------------
Description:
In https://github.com/apache/ozone/pull/8820#discussion_r2211852142, it occurred to me that we might be abusing {{catch (Throwable }} for error handling in some cases:
https://github.com/search?q=repo%3Aapache%2Fozone%20%22catch%20(Throwable%20%22&type=code
Problem is, {{Error}} extends {{Throwable}} and thus will be caught in these cases. And it doesn't make sense to catch {{Error}} (which includes {{OutOfMemoryError}}):
bq. An Error is a subclass of Throwable that indicates serious problems that a reasonable application should not try to catch. Most such errors are abnormal conditions. The ThreadDeath error, though a "normal" condition, is also a subclass of Error because most applications should not try to catch it.
https://docs.oracle.com/javase/8/docs/api/java/lang/Error.html
What do you think? [~adoroszlai] [~weichiu]
was:
In https://github.com/apache/ozone/pull/8820#discussion_r2211852142, it occurred to me that we might be abusing {{catch (Throwable }} for error handling in some cases:
https://github.com/search?q=repo%3Aapache%2Fozone%20%22catch%20(Throwable%20%22&type=code
Problem is, {{Error}} extends {{Throwable}} and thus will be caught in these cases. And it doesn't make sense to catch {{Error}}s (which includes {{OutOfMemoryError}}):
bq. An Error is a subclass of Throwable that indicates serious problems that a reasonable application should not try to catch. Most such errors are abnormal conditions. The ThreadDeath error, though a "normal" condition, is also a subclass of Error because most applications should not try to catch it.
https://docs.oracle.com/javase/8/docs/api/java/lang/Error.html
What do you think? [~adoroszlai] [~weichiu]
> Reconsider catching Throwable
> -----------------------------
>
> Key: HDDS-13471
> URL: https://issues.apache.org/jira/browse/HDDS-13471
> Project: Apache Ozone
> Issue Type: Task
> Reporter: Siyao Meng
> Priority: Major
>
> In https://github.com/apache/ozone/pull/8820#discussion_r2211852142, it occurred to me that we might be abusing {{catch (Throwable }} for error handling in some cases:
> https://github.com/search?q=repo%3Aapache%2Fozone%20%22catch%20(Throwable%20%22&type=code
> Problem is, {{Error}} extends {{Throwable}} and thus will be caught in these cases. And it doesn't make sense to catch {{Error}} (which includes {{OutOfMemoryError}}):
> bq. An Error is a subclass of Throwable that indicates serious problems that a reasonable application should not try to catch. Most such errors are abnormal conditions. The ThreadDeath error, though a "normal" condition, is also a subclass of Error because most applications should not try to catch it.
> https://docs.oracle.com/javase/8/docs/api/java/lang/Error.html
> What do you think? [~adoroszlai] [~weichiu]
--
This message was sent by Atlassian Jira
(v8.20.10#820010)
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org