summaryrefslogtreecommitdiff
path: root/oauthlib/oauth1/rfc5849/errors.py
diff options
context:
space:
mode:
authorIb Lundgren <ib.lundgren@gmail.com>2014-09-24 15:30:46 +0100
committerIb Lundgren <ib.lundgren@gmail.com>2014-09-24 15:30:46 +0100
commit39013947bd2e242dda85fb0f150c49be23fd7510 (patch)
tree6db8bf4baa0cc648ac3323d019393bbeca256322 /oauthlib/oauth1/rfc5849/errors.py
parentedab385f951e38d65a25003f193793b63037bdec (diff)
downloadoauthlib-39013947bd2e242dda85fb0f150c49be23fd7510.tar.gz
Fix error message init and add request details.
Errors were not initialised and thus no message would be included. Changed to now include the error label, description and request details.
Diffstat (limited to 'oauthlib/oauth1/rfc5849/errors.py')
-rw-r--r--oauthlib/oauth1/rfc5849/errors.py8
1 files changed, 7 insertions, 1 deletions
diff --git a/oauthlib/oauth1/rfc5849/errors.py b/oauthlib/oauth1/rfc5849/errors.py
index ee1c782..978035e 100644
--- a/oauthlib/oauth1/rfc5849/errors.py
+++ b/oauthlib/oauth1/rfc5849/errors.py
@@ -13,6 +13,7 @@ from oauthlib.common import urlencode, add_params_to_uri
class OAuth1Error(Exception):
error = None
+ description = ''
def __init__(self, description=None, uri=None, status_code=400,
request=None):
@@ -35,7 +36,12 @@ class OAuth1Error(Exception):
request: Oauthlib Request object
"""
- self.description = description
+ self.description = description or self.description
+ message = '(%s) %s' % (self.error, self.description)
+ if request:
+ message += ' ' + repr(request)
+ super(OAuth1Error, self).__init__(message)
+
self.uri = uri
self.status_code = status_code