Skip to content

Commit

Permalink
Improved the error message displayed when there are not allowed chara…
Browse files Browse the repository at this point in the history
…cters
  • Loading branch information
grzesiek2010 committed Oct 28, 2023
1 parent 89ce8b4 commit bd6e285
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion pyxform/validators/pyxform/android_package_name.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,6 @@ def validate_android_package_name(name: str) -> Optional[str]:
pattern = re.compile(r"[^a-zA-Z0-9._]")
for segment in segments:
if pattern.search(segment):
return f"{prefix}the package name contains not allowed characters."
return f"{prefix}the package name contains characters that are not allowed in segment: {segment}. Package names can only include letters (a-z, A-Z), numbers (0-9), dots (.), and underscores (_)."

return None
2 changes: 1 addition & 1 deletion tests/validators/pyxform/test_android_package_name.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ def test_invalid_start_with_digit(self):

def test_invalid_character(self):
result = validate_android_package_name("com.example.app$")
expected_error = "Parameter 'app' has an invalid Android package name - the package name contains not allowed characters."
expected_error = "Parameter 'app' has an invalid Android package name - the package name contains characters that are not allowed in segment: app$. Package names can only include letters (a-z, A-Z), numbers (0-9), dots (.), and underscores (_)."
self.assertEqual(result, expected_error)

def test_package_name_segment_with_zero_length(self):
Expand Down

0 comments on commit bd6e285

Please sign in to comment.