Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Exceptions Thrown From Subscribers Are Ignored? #58

Closed
GrahamCampbell opened this issue Oct 25, 2014 · 8 comments
Closed

Exceptions Thrown From Subscribers Are Ignored? #58

GrahamCampbell opened this issue Oct 25, 2014 · 8 comments

Comments

@GrahamCampbell
Copy link
Member

ph4kkhi
For some reason the code continues without throwing this exception at a later point? This used to work in guzzle 4. I've done some debugging, and this exception is definitely thrown from this subscriber, but for some reason guzzle ignores it, and continues anyway?

@mtdowling
Copy link
Member

The exception is associated with the transaction, the error event is emitted, then to end event is emitted. The command layer process event is emitted for both successful and error conditions in the request life cycle. If unhandled, the exception is thrown. The point is that Guzzle ensures that the events are always emitted to allow listeners to handle error conditions.

On Oct 25, 2014, at 12:19 PM, Graham Campbell notifications@github.com wrote:

For some reason the code continues without throwing this exception? This used to work in laravel 4. I've done some debugging, and this exception is definitely thrown from this subscriber, but for some reason guzzle ignores it, and continues anyway?


Reply to this email directly or view it on GitHub.

@GrahamCampbell
Copy link
Member Author

How come the behaviour has changed between guzzle 4 and guzzle 5?

@mtdowling
Copy link
Member

Can you be more specific? The reason it changed is it's a better API that has specific state transitions.

On Oct 25, 2014, at 1:56 PM, Graham Campbell notifications@github.com wrote:

How come the behaviour is changed between guzzle 4 and guzzle 5?


Reply to this email directly or view it on GitHub.

@GrahamCampbell
Copy link
Member Author

I was expecting an exception to be thrown at the very end, but instead, the model array was returned.

@GrahamCampbell
Copy link
Member Author

Your docs say that:

When the CommandErrorEvent is not intercepted with a result, then a GuzzleHttp\Command\Exception\CommandException is thrown.

This never happened?

@GrahamCampbell
Copy link
Member Author

@GrahamCampbell
Copy link
Member Author

What do you make of #59 @mtdowling?

@mtdowling
Copy link
Member

I'm AFK right now, but yes, there's a bug there because it needs to check for an exception before creating a result.

On Oct 25, 2014, at 2:57 PM, Graham Campbell notifications@github.com wrote:

Should we not be checking getException in https://github.com/guzzle/guzzle-services/blob/master/src/Subscriber/ProcessResponse.php#L68?


Reply to this email directly or view it on GitHub.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants