elastic / elastic/apm-agent-php
Expected error being overwritten by last thrown exception
- Dominant language
- PHP
- Stars
- 268
- Forks
- 86
- PR merge metrics
- No merged PRs in 30d
Description
**Describe the bug**
Occasionally when our application throws an exception, the expected error is replaced by a caught exception that is thrown in the error handler.
A basic example of what I'm seeing is that our application will throw
```
throw new Exception('Cancellation failed. '.$e->getMessage());
```
which Laravel reports to Sentry. Sentry has the correct error but this is the exception reported to ELK:

However, this exception is caught and ignored in `getComposerPackages`.

**To Reproduce**
I've been unable to replicate this outside of our environment. I will create an application with our exact versions and try to replicate it.
**Expected behavior**
The correct exception is reported.
Contributor guide
Assessment
This issue has not been assessed yet.