Stephen Coakley:
So what should be the desired behavior, in regard to bug #68270? One
possible behavior would be to, if an exception is thrown inside a
finally block, to attach the uncaught exception from the try block via
the addSupressed() method. The last exception is thrown, and the
Markus Malkusch:
The try-finally scenario involves only one supressed
exception. I'd like to see a possibility to add more supressed
exceptions
Actually try-finally can already involve several supressed exceptions as
well:
try {
throw new Exception(Exception 1);
} finally {
try {
Markus Malkusch:
try {
throw new Exception(Exception 1);
} finally {
try {
} finally {
throw new Exception(Exception 3);
}
}
In this case the only place for the suppressed exception 1 can be
exception 3. For consistency and simplicity I'd therefore suggest
Stephen Coakley:
This is the behavior in both Java and C#. Python has a different
approach. Python has two properties that contain previous exceptions:
__context__, which holds implicitly chained exceptions, and __cause__,
which holds explicitly chained exceptions. This system makes a ton of
On 08/02/2015 03:50 AM, Markus Malkusch wrote:
Stephen Coakley:
So what should be the desired behavior, in regard to bug #68270? One
possible behavior would be to, if an exception is thrown inside a
finally block, to attach the uncaught exception from the try block via
the addSupressed()
Christoph Becker:
Markus Malkusch wrote:
I'd like to revise that. I'd just learned that finally does indeed fit
here, as it would automatically glue exceptions:
[..]
Note that there's an open bug report (https://bugs.php.net/68270)
regarding this issue.
Thank you for pointing to that bug.
Markus Malkusch wrote:
Markus Malkusch:
2) You are loosing one stack trace
I'd like to revise that. I'd just learned that finally does indeed fit
here, as it would automatically glue exceptions:
try {
throw new Exception(A);
} finally {
throw new Exception(B);
}
This
On 08/01/2015 09:44 AM, Markus Malkusch wrote:
Christoph Becker:
Markus Malkusch wrote:
I'd like to revise that. I'd just learned that finally does indeed fit
here, as it would automatically glue exceptions:
[..]
Note that there's an open bug report (https://bugs.php.net/68270)
regarding
On 08/01/2015 09:44 AM, Markus Malkusch wrote:
Christoph Becker:
Markus Malkusch wrote:
I'd like to revise that. I'd just learned that finally does indeed fit
here, as it would automatically glue exceptions:
[..]
Note that there's an open bug report (https://bugs.php.net/68270)
regarding
Markus Malkusch:
2) You are loosing one stack trace
I'd like to revise that. I'd just learned that finally does indeed fit
here, as it would automatically glue exceptions:
try {
throw new Exception(A);
} finally {
throw new Exception(B);
}
This prints both exceptions:
PHP Fatal
On 07/31/2015 08:25 PM, Markus Malkusch wrote:
Stephen Coakley:
Interesting thought, but how is this different than including a previous
throwable and throwing a new, more descriptive exception?
} catch (Exception $e1) {
try {
$resource-close();
} catch
Stephen Coakley:
Interesting thought, but how is this different than including a previous
throwable and throwing a new, more descriptive exception?
} catch (Exception $e1) {
try {
$resource-close();
} catch (ResourceException $e2) {
// Pass in $e2 as the
On 07/28/2015 04:51 PM, Markus Malkusch wrote:
Hi PHP
So I read that there's this Throwable interface coming. Great! How about
extending it with one further method:
void Throwable::addSuppressed(Throwable exception)
Semantic is the same as Java's Throwable.addSuppressed()ยน.
Why? Well
Stephen Coakley:
Interesting thought, but how is this different than including a previous
throwable and throwing a new, more descriptive exception?
Thank you for asking. If you would have again a look at the code
fragment from the previous mail you will notice that there are two
immutable
14 matches
Mail list logo