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

Allow throwing exceptions for HTTP error codes to better check query param input. #14023

Merged
merged 8 commits into from May 15, 2019

Conversation

diosmosis
Copy link
Member

@diosmosis diosmosis commented Jan 25, 2019

Added two new exceptions HttpCodeException and BadRequestException that allows changing the HTTP code returned for an exception (in both controller & API).

This allows us to avoid certain failures caused by invalid input and correctly report the error, w/o triggering a 500 HTTP code (that could potentially also create an email alert?).

Used in ScheduledReports API to check for multiple periods.

Fixes #13752

@diosmosis diosmosis added the Needs Review PRs that need a code review label Jan 25, 2019
@diosmosis diosmosis added this to the 3.9.0 milestone Jan 25, 2019
@diosmosis diosmosis added the not-in-changelog For issues or pull requests that should not be included in our release changelog on matomo.org. label Jan 25, 2019
core/Plugin/Visualization.php Show resolved Hide resolved
plugins/CoreVisualizations/Visualizations/HtmlTable.php Outdated Show resolved Hide resolved
@sgiehl
Copy link
Member

sgiehl commented Feb 23, 2019

@diosmosis this one needs a rebase / merge to solve the conflicts

@mattab mattab modified the milestones: 3.9.0, 3.10.0 Mar 18, 2019
core/ExceptionHandler.php Outdated Show resolved Hide resolved
@tsteur
Copy link
Member

tsteur commented Apr 11, 2019

Left 2 comments, otherwise good to merge when tests pass 👍

@diosmosis diosmosis merged commit cecec67 into 3.x-dev May 15, 2019
@diosmosis diosmosis deleted the invalid-param-exception branch May 15, 2019 01:16
@sgiehl sgiehl mentioned this pull request May 20, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Needs Review PRs that need a code review not-in-changelog For issues or pull requests that should not be included in our release changelog on matomo.org.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

fatal error triggered under some circumstances
4 participants