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

LoggerInterface::error() has unexpected side-effects in admin #1634

Open
GuySartorelli opened this issue Dec 14, 2023 · 0 comments
Open

LoggerInterface::error() has unexpected side-effects in admin #1634

GuySartorelli opened this issue Dec 14, 2023 · 0 comments

Comments

@GuySartorelli
Copy link
Member

Found while fixing silverstripe/silverstripe-framework#11034

If you log an error while saving a record, even though the record is successfully saved, the toast message turns red (as though it was a failure), and the form doesn't reload.

The toast message is unaffected - it's still the success message. The record still gets saved. The problem is specifically that the wrong type of toast is used, and the form doesn't reload.

Notes

  • This was specifically tested using this code - it's not clear whether the specific .errorhandler service affects it, but probably not
    /** @var LoggerInterface $logger */
    $logger = Injector::inst()->get(LoggerInterface::class . '.errorhandler');
    $logger->error('Error sending email in ' . __FILE__ . ' line ' . __LINE__ . ": {$e->getMessage()}");
  • using warning() instead of error() does not exhibit this buggy behaviour. It is specifically when logging an error that this occurs.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant