Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:122330 Return-Path: <6562680@gmail.com> Delivered-To: mailing list internals@lists.php.net Received: (qmail 77239 invoked from network); 7 Feb 2024 15:15:40 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 7 Feb 2024 15:15:40 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1707318992; bh=KYeJby8NUQfhdP/78ESn77kMZXGP+Qfa6S+I3ROulCo=; h=References:In-Reply-To:From:Date:Subject:To:From; b=kEY3bYqgTAxHfkg8lVa80LXtrfiLRfPsohL10H715V4dr53ZCdOJnD+hM9NFJ8cIk tS01VBXtQZE5avJzQd3FUyC9Ny84IqVjNLBy9aOAausbt7QA9/sxuzLGoh2PYrq/tK rbKD5MLmrv+rf8iU5n5cgDwbXQf+Rwu1jlTUjhc5gJGDw1MqZ5waaZDydHlhGcEEbk gmjzeZnBFlMkqChbHo4eEKMm0nUXA5TIXCAj1NnhNOmRYS/c0OvDcdt8ZaNgZiyvcl 4bBJY+lKl00R9Mlafc2L0YR4FPiQeA3lHEZJAErYN27+gDd59uFw4qFb7qQwSwu4JK qjhNngRvpsHZg== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 2446C180059 for ; Wed, 7 Feb 2024 07:16:32 -0800 (PST) X-Spam-Checker-Version: SpamAssassin 4.0.0 (2022-12-13) on php-smtp4.php.net X-Spam-Level: X-Spam-Status: No, score=-0.4 required=5.0 tests=BAYES_00,BODY_8BITS, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,DMARC_PASS, FREEMAIL_ENVFROM_END_DIGIT,FREEMAIL_FROM,HTML_MESSAGE, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE, SPF_PASS autolearn=no autolearn_force=no version=4.0.0 X-Spam-Virus: No X-Envelope-From: <6562680@gmail.com> Received: from mail-oo1-f46.google.com (mail-oo1-f46.google.com [209.85.161.46]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by php-smtp4.php.net (Postfix) with ESMTPS for ; Wed, 7 Feb 2024 07:16:31 -0800 (PST) Received: by mail-oo1-f46.google.com with SMTP id 006d021491bc7-59a29a93f38so260482eaf.0 for ; Wed, 07 Feb 2024 07:15:38 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1707318938; x=1707923738; darn=lists.php.net; h=to:subject:message-id:date:from:in-reply-to:references:mime-version :from:to:cc:subject:date:message-id:reply-to; bh=KYeJby8NUQfhdP/78ESn77kMZXGP+Qfa6S+I3ROulCo=; b=Ih9mOsNb+JCVOWdWcXVw1Z0ZyA7PFYCBi4CEkDEyjU8FjuPTtefIUyWwNiH3otO1/X iiA8A6Bsb0D+Lboa2Ivw4qoVyWt0NZ+L0faKx+ZbDWltpA4P0a7fkUBSUWsGujpLAGTT TOPE+FZzOUS1P2wel7lIIv2btSpv2TcXejqsvKrMcMe1mfIt+X7S0WiX8x2uxaFlpLi1 pwxMz5YAmYLxuhXdNUxMn+JD98AYsh5BLOUtB4itUDa+2QCrUKhxfKFV5CPSwyvlj0DZ LRVA5dKkg6KNPdOVE6qPxIOUC1NtrLfAV80b2cub34P2TKea7FP+/YsVkWCUe7Fq9Fvy /GVQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1707318938; x=1707923738; h=to:subject:message-id:date:from:in-reply-to:references:mime-version :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=KYeJby8NUQfhdP/78ESn77kMZXGP+Qfa6S+I3ROulCo=; b=sqOeVtwE91DbdLwH3gA4QAEQhqz6AGzPpHqYq4Snw3TSkfojlpsJV8/iZRqgXqFgtB Ic3eccjCMKfxknsAkRTNw7x8RBmqQpFJOTb8KBBqSAIyGW2WSj3zYGuCkHuIf2NFGTnd Hl2IFVDtHfHNH3/krsMdVVpFGpwAiYh408ZeSkXFURRvIWmWt6KCjKSdZLvmkIL9F++T nOURNvVzQqt8IIyqZOlpq76GAdKAEhBkkGUeqSXcs3qzuhaj6L8Qe6fTstPVU4UjH5Sj nzSAC8mr4qSdqTMx9cWjDmZARyGiDDy8MBJq6E+9BwlNnKEHt/pFEXt+2NEAaUSAPqdS pzGw== X-Gm-Message-State: AOJu0YxbLeGz5WeMf5A/oO06oMIlNDrwdl/An0D3B4Hz3uVydVGs5l6/ byktb0m9Q/A3THxyCWTcbYhzHWHg1qMTV4/62fQRhQUS3tildciR7nl1Q4ff3YUEiyWBsbVrSLV E2UlKHUd3byncRU6qgs7U9lV9RlqGtL9VFi0o7Q== X-Google-Smtp-Source: AGHT+IH4bN249f8zyKlPGfd69L6ggKvvOp/GbA9xyL/DTPZ3p+TE3xCMt+pjDhqzAyCcosc/LI0zzAGvoXZ4anWjdGY= X-Received: by 2002:a4a:6510:0:b0:59c:a7d9:cb2b with SMTP id y16-20020a4a6510000000b0059ca7d9cb2bmr6720718ooc.0.1707318937869; Wed, 07 Feb 2024 07:15:37 -0800 (PST) MIME-Version: 1.0 References: <742f202d-7990-4f51-b903-7a15e3fd33c2@app.fastmail.com> <3db4fbe0-22f4-44e2-a1a6-6cd85287df56@app.fastmail.com> <4fa06ed3-855a-4952-a1fe-c97c5249b814@app.fastmail.com> In-Reply-To: =?UTF-8?B?Yg==?= <6562680@gmail.com> Date: Wed, 7 Feb 2024 18:15:01 +0300 Message-ID: To: internals@lists.php.net Content-Type: multipart/alternative; boundary="000000000000cf5fe60610cc2ab3" Subject: Re: [PHP-DEV] Feature request: https://github.com/php/php-src/issues/13301 From: 6562680@gmail.com (=?UTF-8?B?0JPRgNC40LPQvtGA0LjQuSBTZW5pb3IgUEhQIC8g0KDQsNC30YDQsNCx0L7RgtGH0LjQuiBXZQ==?==?UTF-8?B?Yg==?=) --000000000000cf5fe60610cc2ab3 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable As I mentioned above - javascript pipelines (named `Promise` and `Thenable`) are great examples when exceptions are a bad choice. Btw, not "bad", but "choice to stop one step of the chain only". If any step of chain/foreach throws an exception - it will break all code. Should break one step. That's why you throw the immediate catch. And continue to check via if-checking once the result of the pipeline is received. Catching is a good solution for the application core. If some exception pops up at the entrypoint - you could transform the exception to the output. All other cases should be covered without exceptions. If you use exceptions on any occurred error as "truth way" you will meet risk and also timeloss on any misformatted batches/user-inputs. =D1=81=D1=80, 7 =D1=84=D0=B5=D0=B2=D1=80. 2024=E2=80=AF=D0=B3. =D0=B2 18:06= , =D0=93=D1=80=D0=B8=D0=B3=D0=BE=D1=80=D0=B8=D0=B9 Senior PHP / =D0=A0=D0= =B0=D0=B7=D1=80=D0=B0=D0=B1=D0=BE=D1=82=D1=87=D0=B8=D0=BA Web < 6562680@gmail.com>: > Analyzing the problem on a single level operation is incorrect. New code > and simple operations are fully covered with exception/try/catch flow. > > The main point i tried to attract your attention is that if you working i= n > batches/queues/pipelines you still need errors collection, and if you mad= e > error flow with exceptions - you have to extract validations to separate > classes/dto-s, made return types as objects, try/catching as fast as > possible, and then you will still met errors from remote systems, network > errors, and invalid response parsing that need to be logged as much close > to task registration place. > > So correct analysis - providing an example with at least foreaches/yields > instead of simply calling native functions. In small functions IF > statements are overkill, and even try-catch could be skipped, because the > whole script will fall and that's correct behavior. > > Case is in that the script should continue working while working with > chaining/nesting, and should be able to easily refactor any step to skip > one or more bulk-data rows of each step on any nesting level. > --=20 +375 (29) 676-48-68 <+375296764868> / Mobile - =D0=BF=D1=80=D0=B5=D0=B4=D0= =BF=D0=BE=D1=87=D0=B8=D1=82=D0=B0=D0=B5=D0=BC=D1=8B=D0=B9 =D1=81=D0=BF=D0= =BE=D1=81=D0=BE=D0=B1 =D1=81=D0=B2=D1=8F=D0=B7=D0=B8 https://t.me/gzhegow / https://t.me/%2B375296764868 / Telegram 6562680@gmail.com --000000000000cf5fe60610cc2ab3--