Javascript is closer to.

It allows you to throw anything, but it is still the throw statement,
keeping in the mind the async nature of js - memory and processor stuff is
shared by the time.

JS seniors usually hate those guys who throw anything except language Error
class because they skipped the mandatory level of programming - OOP. They
are now taking fun from it. We're tired of OOP for now. Once you work with
batches/queue/bulks you need pipelines and chaining, and there's a throw
works only to stop any certain tasks and almost immediately catch the next
line. So `throw` is required to be safe-shield, but solves not enough count
of cases.

Old, maybe 10 years ago, Fowler's article about "errors is not an
exception". He explained why, but recommend to implement own error bag. I
tried few times implement own error bag on production ready code. And this
is the hell of rewriting full nesting tree and carrying that return
statement to upper level again and again, then you start to get confused,
then you rewrite all return to objects with properties/getters/setters,
then you understand your PHPStorm started to lag because of 70 uses in
class... Better to use global error bag stack that you can enable or
disable for your needs outside function ("in controller", GRASP) or inside
function directly like old good times $errors[] and if ($errors) { return
null; }


вт, 6 февр. 2024 г. в 18:23, Alex Wells <autau...@gmail.com>:

> On Tue, Feb 6, 2024 at 3:58 PM Григорий Senior PHP / Разработчик Web <
> 6562...@gmail.com> wrote:
>
>> - add non-breakable interface and language construct `raise` to "throw"
>> error without collecting trace
>> - that error could be any scalar or object, or you can implement new
>> interface for them, keeping that is nested and taggable array
>> - this `raise` could be catched same way as \Throwable allowing log it
>> anywhere you need or re-`raise` again
>> - `raise` statement won't start to collapse/break code, so it could be
>> skipped without affecting application
>>
>
> Is there an existing language that does that, having both exceptions and
> these silent raise statements?
>


-- 
+375 (29) 676-48-68 <+375296764868> / Mobile - предпочитаемый способ связи
https://t.me/gzhegow / https://t.me/%2B375296764868 / Telegram
6562...@gmail.com
  • [PHP-DEV] Feature... Григорий Senior PHP / Разработчик Web
    • Re: [PHP-DEV... Arvids Godjuks
      • Re: [PHP... Arvids Godjuks
        • Re: ... Григорий Senior PHP / Разработчик Web
          • ... Alexander Pravdin
            • ... Григорий Senior PHP / Разработчик Web
              • ... Alex Wells
              • ... Robert Landers
    • Re: [PHP-DEV... Alex Wells
      • Re: [PHP... Григорий Senior PHP / Разработчик Web
        • Re: ... Arvids Godjuks
          • ... Григорий Senior PHP / Разработчик Web
            • ... Григорий Senior PHP / Разработчик Web
              • ... Larry Garfield
                • ... Arvids Godjuks
                • ... Jordan LeDoux
                • ... Григорий Senior PHP / Разработчик Web
                • ... Larry Garfield
                • ... Robert Landers
                • ... Григорий Senior PHP / Разработчик Web

Reply via email to