diff piecrust/uriutil.py @ 942:e1b33cbf9874

internal: Give better exception messages when splitting URIs.
author Ludovic Chabant <ludovic@chabant.com>
date Thu, 05 Oct 2017 00:21:50 -0700
parents 4850f8c21b6e
children
line wrap: on
line diff
--- a/piecrust/uriutil.py	Wed Oct 04 21:38:00 2017 -0700
+++ b/piecrust/uriutil.py	Thu Oct 05 00:21:50 2017 -0700
@@ -16,7 +16,8 @@
     root = app.config.get('site/root')
     uri_root = uri[:len(root)]
     if uri_root != root:
-        raise Exception("URI '%s' is not a full URI." % uri)
+        raise Exception("URI '%s' is not a full URI, expected root '%s'." %
+                        (uri, root))
     uri = uri[len(root):]
     return uri_root, uri
 
@@ -24,7 +25,8 @@
 def split_sub_uri(app, uri):
     root = app.config.get('site/root')
     if not uri.startswith(root):
-        raise Exception("URI '%s' is not a full URI." % uri)
+        raise Exception("URI '%s' is not a full URI, expected root '%s'." %
+                        (uri, root))
 
     pretty_urls = app.config.get('site/pretty_urls')
     trailing_slash = app.config.get('site/trailing_slash')