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

RapidPro: Issue error if router comparison arguments are empty strings #164

Merged
merged 3 commits into from
Feb 21, 2025

Conversation

geoo89
Copy link
Contributor

@geoo89 geoo89 commented Feb 14, 2025

Errors like this are not covered by the test suite, so please test manually that the error messages are as desired.

fixes #160

@geoo89 geoo89 requested a review from fagiothree February 14, 2025 17:45
@fagiothree
Copy link
Member

fagiothree commented Feb 17, 2025

@geoo89 @istride currently the output RapidPro json is still generated even if it's invalid and that the user just gets a warning. Is this preferrable to getting an error and stopping the process?

@istride
Copy link
Contributor

istride commented Feb 17, 2025

We should always be creating valid output, but if we absolutely cannot we should fail. If the output is not useful (even if it is valid), we should also fail.

@@ -202,6 +202,7 @@ def generate_category_name(self, comparison_arguments):
# Auto-generate a category name that is guaranteed to be unique
# TODO: Write tests for this
Copy link
Contributor

Choose a reason for hiding this comment

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

This todo comment was written over 4 years ago - I think it's time it was removed. Personally, I would only use todos when work is in progress and remove them before merging.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fair enough, I guess it's not going to happen (and not important enough to capture in an issue?)

@@ -537,8 +542,8 @@ def validate(self):
raise ValueError(f'Invalid router test type: "{self.type}"')
if not RouterCase.TEST_VALIDATIONS[self.type](self.arguments):
print(
Copy link
Contributor

Choose a reason for hiding this comment

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

We should use the logger, or raise an exception, rather than print.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Agreed. Streamlined the use of exceptions here. (I'm not using the logger in the rapidpro sublibrary.)

@fagiothree fagiothree merged commit be704ce into main Feb 21, 2025
12 checks passed
@fagiothree fagiothree deleted the iss160 branch February 21, 2025 11:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Category names should not be empty
3 participants