Re: [RFC] [Discussion] Support object type in BCMath
| From: | Tim Düsterhus | Date: | Sun, 07 Apr 2024 16:45:24 +0000 |
| Subject: | Re: [RFC] [Discussion] Support object type in BCMath | ||
| References: | 1 2 3 4 5 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-123019@lists.php.net to get a copy of this message | ||
Hi
On 3/28/24 14:30, Saki Takamachi wrote:
Thanks. Sorry, I meant "If I create dedicated exception classes, do I need separate classes for each type of error?” I couldn't write it well in English.To answer this question, even if it is not necessary after all: You should create separate classes for each type of error the user is expected to handle differently so that developers to not need to check the exception message to find out what the error was in their code. Here's an insightful GitHub comment from Danack: https://github.com/php/php-src/pull/9071#issuecomment-1193162754 And here's the PR adding a proper Exception hierarchy to ext/random: https://github.com/php/php-src/pull/9220 For ext/date, here's the RFC adding the new Exception hierarchy: https://wiki.php.net/rfc/datetime-exceptions. If I remember correctly, the choices made for ext/date followed the precedent set by ext/random. Best regards Tim Düsterhus