Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:128253 X-Original-To: internals@lists.php.net Delivered-To: internals@lists.php.net Received: from php-smtp4.php.net (php-smtp4.php.net [45.112.84.5]) by lists.php.net (Postfix) with ESMTPS id 91A201A00BC for ; Mon, 28 Jul 2025 11:48:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1753703210; bh=Z2HAr1+kR+DfYSIcqOJdVdbN+InA7VDHL35p5Z8X9RU=; h=References:In-Reply-To:From:Date:Subject:Cc:From; b=GUL5TSWBjuDwCiXd6GO9Sol5aZmqiylU2dahmzXkaJidE5sKeqH08hB+zHunKQ5Ia 36bcaSJOGp8PmgIxaVkEsd83lQBK2prbX8+xrPGFBoGRGfQ1ovu/0BG33H2EjEiI1R EcRzZ46exueh7Hr0lUChbcRVaLFQFEeB2/Jl1jtfnSK5/xD7vBx/1G2oB+Q4sKU0Cg o0rP+go0W2tUBaFoE7f7ZiWKIZfuPPvLv4/5/CkovpNFJpsoEztkLIrNSZv772J0Bb 0hHYthfjsbwSh/FcZMmlI91iNfODzmt5K27cgGtsZY04MQ5sW1NYHuGLXCCdwWflNE 48x8Y4zmAxjgg== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 679A71801D7 for ; Mon, 28 Jul 2025 11:46:49 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-25) on php-smtp4.php.net X-Spam-Level: X-Spam-Status: No, score=0.8 required=5.0 tests=BAYES_20,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,DMARC_PASS,FREEMAIL_FROM, HTML_MESSAGE,MALFORMED_FREEMAIL,MISSING_HEADERS,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=4.0.1 X-Spam-Virus: Error (Cannot connect to unix socket '/var/run/clamav/clamd.ctl': connect: Connection refused) X-Envelope-From: Received: from mail-wr1-f45.google.com (mail-wr1-f45.google.com [209.85.221.45]) (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 ; Mon, 28 Jul 2025 11:46:49 +0000 (UTC) Received: by mail-wr1-f45.google.com with SMTP id ffacd0b85a97d-3b7823559a5so808371f8f.0 for ; Mon, 28 Jul 2025 04:48:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1753703311; x=1754308111; darn=lists.php.net; h=cc:subject:message-id:date:from:in-reply-to:references:mime-version :from:to:cc:subject:date:message-id:reply-to; bh=Z2HAr1+kR+DfYSIcqOJdVdbN+InA7VDHL35p5Z8X9RU=; b=QgNyUnnG7+PbqsOIGCm7GOOBY4bpwvHKKxBmvycz7qZSH8svbwTCq1+WVdLZ7NMnLM Ngbx8tx4lExPN3PBgWHAYDhOePGkUtCQNT0GiPmrccr2HvjUvVBnEwSLjHZd0T6D+Qwa o4JNYb8I67ew0Rig58WHLea7bsHXqimwAMlDQVLTKWsQU+CnhDRHspVcNvYYDPLgr7cW avSKxZloyvCNjdfSKnZATh5ehhJZF6yGgLL0KkoAEQCGHKQYIRO/KMg2H7i5wdEIRzoZ H6S8PVQuB1JfcwBNGL1idEc0WQr9JwxFOXs6oFPAjMjG+UP85Hxyx/k5W1KQ16E7JP+X OOjQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1753703311; x=1754308111; h=cc: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=Z2HAr1+kR+DfYSIcqOJdVdbN+InA7VDHL35p5Z8X9RU=; b=urHlZspB/lbOicCF9poKJytRvs5VaXpTiTl8lSiFDVcYzBSxudjxk78YyzwU8qiptj vADHSoAryJ4LZF6mjC/f+Vo6GWG9XGkNacMdQIE/5s+S6EEp4ln7sltzs251VJpLxiHw lVm+FqP+r1AZKQyC9Ssp+WscwNbMesZZonrehgiaV1C4n5yadFIjZul0aRje639N6RHr uZ66hJpRTl9G5eG2+gg3gcgbSvjVev2/KhkWwsoRPKkHkrvMeLe5tzdtf14mv8AsfhDN rI+jH0BwEBONihskDUpeqsWPyntg5H09wO6Kqpj8bmtnZ3CV5Jrc+isRqGSAji32t7QZ EJZQ== X-Gm-Message-State: AOJu0YzdK9rQWE2HsSho/bvB7lDvF6AuRSoI3VHObgf8oJ/i6vDDX8M3 B5G0k84MeyjnzYzCE5wi1UR9gmMSbnPwjyMc1v6zM6fXEc4ZKMtdFnXsl1dAs+lt0FjyuP293XP tvWByEqRa7SzTCmac63xmsABdAI+3oJqt1OXk X-Gm-Gg: ASbGnctW4rVAOF6LcNolv6F8abMU8Dq9f7Hhfe2XcAbbQAlGfMZdq8CPsAjmwEio3NJ jdpNwtBSvz44sz41wNu6nJwXGl7m1xrvbvaWYHc0sZJrsEOqWtl/+PDiVZd5+ErZMap2Yf9/Mrh g5MiD+s62dhFLY3ExbEts0W+Q19Sso5/6eTYJt5t93Toy3Hn+7KemmAzrlJDH/BMpe3GuJGwomP D7OmQ== X-Google-Smtp-Source: AGHT+IEls5RJGdGpo6jWpIHYJNUgTfCGdFjMZazntelyQc9uFpAvgW4GukQiw70ObHdYJ6hR8jovDKXvmU7Ls3l3mSE= X-Received: by 2002:a05:6000:430b:b0:3a4:e4ee:4ca9 with SMTP id ffacd0b85a97d-3b776732930mr6931692f8f.23.1753703310688; Mon, 28 Jul 2025 04:48:30 -0700 (PDT) Precedence: bulk list-help: list-post: List-Id: internals.lists.php.net x-ms-reactions: disallow MIME-Version: 1.0 References: <73a35675dff31a1eaf76b67af567194e@bastelstu.be> In-Reply-To: <73a35675dff31a1eaf76b67af567194e@bastelstu.be> Date: Mon, 28 Jul 2025 14:48:15 +0300 X-Gm-Features: Ac12FXznTHd2Sd6dDfIf9qaiKJb0F-z0WMaPhM9ic2g3YqDM8HufcC43BIKVVg8 Message-ID: Subject: Re: [PHP-DEV] [DISCUSSION] User-land Throwable Cc: PHP internals Content-Type: multipart/alternative; boundary="000000000000e00840063afbde42" From: raveren@gmail.com (=?UTF-8?Q?Rokas_=C5=A0leinius?=) --000000000000e00840063afbde42 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Mon, 28 Jul 2025 at 13:56, Tim D=C3=BCsterhus wrote: > Hi > > Am 2025-07-28 11:41, schrieb Dmitry Derepko: > > A few years ago I found that a library printed error traces wrong. > > After a little research I found that there was a mix of 3rd party > > integration error + raised error around the current bridge > > implementation > > (http client). > > > > There were several PHP applications with microservices architecture > > which I > > had access to (docker + sources). > > > > So having the message and traces I'd like to have an error chain as it > > can > > be done chaining several errors through a new Exception(previous: $e). > > But PHP does not allow you to manually implement Throwable. Instead you > > should extend Exception. But after that you still cannot override the > > getTrace() method because it's final. > > > > So my proposal is pretty simple: Remove both restrictions. > > I'm afraid I don't quite understand what actual goal you intend to solve > with the proposal. The description of your use case is very abstract, > can you provide a real-world example of a use-case you want to enable? > > Best regards > Tim D=C3=BCsterhus > | real-world example of a use-case you want to enable Say I am implementing a job runner, I do its error handling, and I want to enrich the caught exception with additional helpful data for debugging. In this process I create a custom exception MyJobHandlerException, but the trace of the new exception includes my handler code, which the end user does not care about. I wish to overwrite the trace of the new MyJobHandlerException instance with the trace from the originally caught exception, but I cannot. I was always sure that the reason behind all methods of \Exception being final is Larry-Garfield-blogpost length/depth so I never bothered to ask and made workarounds. --000000000000e00840063afbde42 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable

On Mon, 28 Jul 2025 at 13:56, Tim D=C3=BCster= hus <tim@bastelstu= .be> wrote:
Hi

Am 2025-07-28 11:41, schrieb Dmitry Derepko:
> A few years ago I found that a library printed error traces wrong.
> After a little research I found that there was a mix of 3rd party
> integration error + raised error around the current bridge
> implementation
> (http client).
>
> There were several PHP applications with microservices architecture > which I
> had access to (docker + sources).
>
> So having the message and traces I'd like to have an error chain a= s it
> can
> be done chaining several errors through a new Exception(previous: $e).=
> But PHP does not allow you to manually implement Throwable. Instead yo= u
> should extend Exception. But after that you still cannot override the<= br> > getTrace() method because it's final.
>
> So my proposal is pretty simple: Remove both restrictions.

I'm afraid I don't quite understand what actual goal you intend to = solve
with the proposal. The description of your use case is very abstract,
can you provide a real-world example of a use-case you want to enable?

Best regards
Tim D=C3=BCsterhus

|=C2=A0real-world example of a u= se-case you want to enable

Say I am implementing a job runner, I do its error handling, and I want to=20 enrich the caught exception with additional helpful data for debugging.=20 In this process I create a custom exception MyJobHandlerException, but=20 the trace of the new exception includes my handler code, which the end=20 user does not care about. I wish to overwrite the trace of the new=20 MyJobHandlerException instance with the trace from the originally caught exception, but I cannot.

I was always sure that the reason behind all methods of \Exception being=20 final is Larry-Garfield-blogpost length/depth so I never bothered to ask and made workarounds.
--000000000000e00840063afbde42--