Skip to content

How am I supposed to deal with the last exception? #18

@nicolas-grekas

Description

@nicolas-grekas

I have a code like this:

$promise->then(function() {
    // ...
    throw new FirstException();

})->then(null, function ($error) {
    // ...
    throw new SecondException();

});

SecondException() is lost, never handled.
But say for example that I have a PHP error handler that triggers exceptions.
Say then that I am in the middle of my work on the error handling closure (the second one above).
While I code it, I make mistakes, like usual.
How am I supposed to get the SecondException to my eyes so that I can have a great debugging experience? Adding a third "robust" ->then(null, 'debugProvedHandler')?
I'd prefer having an exception thrown from the last error handler be re-thrown, don't you?
Or any other way I'm missing?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions