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

APIv4 - Throw exception instead of munging illegal join aliases #21072

Merged
merged 1 commit into from
Aug 10, 2021

Conversation

colemanw
Copy link
Member

@colemanw colemanw commented Aug 9, 2021

Overview

Improves APIv4 validation of explicit join aliases.

Before

Incorrect aliases would be silently "fixed".

After

Exception thrown.

Technical Details

The problem with "fixing" an illegal join alias is that it's then mysterious what the correct alias will be, leading to bugs when the incorrect alias gets used throughout the rest of the api params.

Throwing an exception seems like a better way to ensure developers are alerted to the error.

@civibot
Copy link

civibot bot commented Aug 9, 2021

(Standard links)

@civibot civibot bot added the master label Aug 9, 2021
catch (\API_Exception $e) {
$message = $e->getMessage();
}
$this->assertEquals('Illegal join alias: "add.ress"', $message);
Copy link
Contributor

Choose a reason for hiding this comment

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

@colemanw - this makes sense but for test legibility could you add an OK alias - that would make it clearer when reading the test IMHO

The problem with "fixing" an illegal join alias is that it's then mysterious
what the correct alias will be, leading to bugs when the incorrect alias
gets used throughout the rest of the api params.

Throwing an exception seems like a better way to ensure developers
are alerted to the error.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants