[ckan-changes] [okfn/ckan] 1d2ac6: Improve reporting of errors.
GitHub
noreply at github.com
Tue Apr 17 20:41:32 UTC 2012
Branch: refs/heads/release-v1.6.1
Home: https://github.com/okfn/ckan
Commit: 1d2ac6664c435c387b673d3ba392d2db0a45260a
https://github.com/okfn/ckan/commit/1d2ac6664c435c387b673d3ba392d2db0a45260a
Author: David Read <david.read at okfn.org>
Date: 2012-04-17 (Tue, 17 Apr 2012)
Changed paths:
M ckan/lib/navl/dictization_functions.py
Log Message:
-----------
Improve reporting of errors.
diff --git a/ckan/lib/navl/dictization_functions.py b/ckan/lib/navl/dictization_functions.py
index 822b29b..a1ad525 100644
--- a/ckan/lib/navl/dictization_functions.py
+++ b/ckan/lib/navl/dictization_functions.py
@@ -27,15 +27,21 @@ def __nonzero__(self):
class State(object):
pass
-class Invalid(Exception):
+class DictizationError(Exception):
+ def __str__(self):
+ if hasattr(self, 'error') and self.error:
+ return repr(self.error)
+ return ''
+
+class Invalid(DictizationError):
def __init__(self, error, key=None):
self.error = error
-class DataError(Exception):
+class DataError(DictizationError):
def __init__(self, error):
self.error = error
-class StopOnError(Exception):
+class StopOnError(DictizationError):
'''error to stop validations for a particualar key'''
pass
================================================================
More information about the ckan-changes
mailing list