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

LeftAndMain::handleRequest() misusing ValidationException #11599

Open
2 tasks
emteknetnz opened this issue Feb 10, 2025 · 0 comments
Open
2 tasks

LeftAndMain::handleRequest() misusing ValidationException #11599

emteknetnz opened this issue Feb 10, 2025 · 0 comments

Comments

@emteknetnz
Copy link
Member

emteknetnz commented Feb 10, 2025

LeftAndMain::handleRequest() is catching ValidationException then using $e->getMessage() and using that as the error message for the HTTP response, which could be then displayed to a CMS author.

ValidationExceptions are intended for developers and not for CMS authors. What is really should be happening is the ValidationResult is extracted from the ValidationException and its message is shown.

However we don't actually currently know what contexts this code path is even triggered, and there may be a reason which makes doing this difficult e.g. there are multiple errors in the Validation result but we should only display the first message.

Acceptance criteria

  • LeftAndMain::handleRequest() no longer relies on the exception message
  • The condition that adds context to the validation exception message is removed, as that information should always be provided where available.
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

2 participants