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

Trigger errors from AJAX methods in non-production mode. #3267

Merged
merged 7 commits into from Jan 29, 2024

Conversation

EreMaijala
Copy link
Contributor

Errors in AJAX request could easily go undetected (e.g. #3266) because they were only in the php_errors element in AJAX responses. This change makes it so that in non-production mode any errors go through the normal triggers so that they can cause the request to fail and the error to be triggered in debugger.

@EreMaijala
Copy link
Contributor Author

Note that I intentionally chose to compare with 'production' instead of 'development' so that you can run Mink tests with e.g. 'preproduction' to enable error triggers but keep Whoops disabled.

Copy link
Member

@demiankatz demiankatz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A few thoughts...

module/VuFind/src/VuFind/Controller/AjaxResponseTrait.php Outdated Show resolved Hide resolved
@EreMaijala
Copy link
Contributor Author

@demiankatz How about this? Real errors would prevent a response from being generated. Warnings and notices would be logged normally while prevented from being displayed. This would ensure that PHP settings are otherwise in effect just like in all other controllers.

Copy link
Member

@demiankatz demiankatz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, @EreMaijala, this seems like a reasonable solution to me! I'll make a note about it in the changelog.

@demiankatz demiankatz merged commit ac14361 into vufind-org:dev Jan 29, 2024
7 checks passed
@demiankatz demiankatz deleted the dev-ajax-dev-mode-errors branch January 29, 2024 13:46
@demiankatz demiankatz added this to the 10.0 milestone Jan 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants