justbetter / magento2-sentry

Magento 2 module to log to Sentry
MIT License
165 stars 70 forks source link

Solve error with no suchentity exception which can occur #103

Open rofokken opened 2 years ago

rofokken commented 2 years ago

Fixes issue when customer is logged in on website en user is deleted. The log wont work anymore and Magento throws error: Could not write error message to log. Please use developer mode to see the message

This catches all exception so normal logging can continue

Summary

Result

indykoning commented 2 years ago

While the normal execution doesn't need to be hindered here i'm not a big fan of ignoring every possible exception that could occur in that code, since this could lead to it being impossible to discover and diagnose bugs in that area of code.

What part of that code throws the NoSuchEntityException and why does it do so? Are we missing a check somewhere? I'd think checking if a customer is logged in would be enough to know it's a customer that is available in the database.

If there's a check we could add to prevent this error that would be my preferred solution. Otherwise i would be content with catching NoSuchEntityException specifically.