Skip to content

Commit

Permalink
clearer url rule slash error
Browse files Browse the repository at this point in the history
  • Loading branch information
TheGreatAlgo authored and davidism committed Aug 13, 2023
1 parent a0f4bf4 commit fdc295a
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:", string)
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 fdc295a

Please sign in to comment.