Re: [RFC] Optional Catch Block Body
| From: | Mihail Liahimov | Date: | Thu, 31 Jul 2025 06:35:53 +0000 |
| Subject: | Re: [RFC] Optional Catch Block Body | ||
| References: | 1 2 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-128325@lists.php.net to get a copy of this message | ||
Hey, Ayesh! Thank you for noticing an important point.
Of course, empty catch blocks are bad practice in most cases. But this
particular proposal is not intended to encourage these bad practices. I'm
just suggesting that you don't have to write an extra boiler plate at the
syntax level in situations where it's necessary.
чт, 31 июл. 2025 г. в 11:21, Ayesh Karunaratne <ayesh@php.watch>:
> > Motivation
> >
> > Reduced Boilerplate: Eliminates unnecessary empty blocks when exceptions
> only need to be caught and ignored.
> > Improved Readability: Makes the code more concise and focuses on the
> important parts.
> >
>
> Empty
catch blocks are a code-smell. If the
> try block is not ready
> to handle the exception, it should let the exception bubble up; not
> silence it. I think we should not encourage this further.
>