From 0482bd06bcde5601ea2ab3b01b774e03f92160b7 Mon Sep 17 00:00:00 2001 From: Chris McDonough Date: Mon, 12 Jul 2010 13:50:49 +0000 Subject: - New internal exception: ``repoze.bfg.exceptions.URLDecodeError``. This URL is a subclass of the built-in Python exception named ``UnicodeDecodeError``. - When decoding a URL segment to Unicode fails, the exception raised is now ``repoze.bfg.exceptions.URLDecodeError`` instead of ``UnicodeDecodeError``. This makes it possible to register an exception view invoked specifically when ``repoze.bfg`` cannot decode a URL. --- repoze/bfg/exceptions.py | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'repoze/bfg/exceptions.py') diff --git a/repoze/bfg/exceptions.py b/repoze/bfg/exceptions.py index e7b6dd570..b0922c1e3 100644 --- a/repoze/bfg/exceptions.py +++ b/repoze/bfg/exceptions.py @@ -26,6 +26,17 @@ class NotFound(Exception): ``repoze.bfg.message`` key, for availability to the :term:`Not Found View`.""" +class URLDecodeError(UnicodeDecodeError): + """ + This exception is raised when :mod:`repoze.bfg` cannot + successfully decode a URL or a URL path segment. This exception + it behaves just like the Python builtin + :exc:`UnicodeDecodeError`. It is a subclass of the builtin + :exc:`UnicodeDecodeError` exception only for identity purposes, + mostly so an exception view can be registered when a URL cannot be + decoded. + """ + class ConfigurationError(ZCE): """ Raised when inappropriate input values are supplied to an API method of a :term:`Configurator`""" -- cgit v1.2.3