Skip to content

Commit

Permalink
Fix: Improve Error Message (#2750)
Browse files Browse the repository at this point in the history
  • Loading branch information
davidism authored Aug 13, 2023
2 parents 1886322 + fdc295a commit dd1f137
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ Unreleased
- ``_plain_int`` and ``_plain_float`` strip whitespace before type
enforcement. :issue:`2734`
- Fix empty file streaming when testing. :issue:`2740`
- Clearer error message when URL rule does not start with slash. :pr:`2750`


Version 2.3.6
Expand Down
3 changes: 2 additions & 1 deletion src/werkzeug/routing/rules.py
Original file line number Diff line number Diff line change
Expand Up @@ -454,7 +454,8 @@ def __init__(
websocket: bool = False,
) -> None:
if not string.startswith("/"):
raise ValueError("urls must start with a leading slash")
raise ValueError(f"URL rule '{string}' must start with a slash.")

self.rule = string
self.is_leaf = not string.endswith("/")
self.is_branch = string.endswith("/")
Expand Down

0 comments on commit dd1f137

Please sign in to comment.