Merge pull request #686 from Quentin-M/bb_logexc

Chatty BitBucket schema validation exception & proper exception
This commit is contained in:
Quentin Machu 2015-10-22 11:59:55 -04:00
commit 1e42a77cfc

View file

@ -183,6 +183,7 @@ def get_transformed_commit_info(bb_commit, ref, default_branch, repository_name,
try:
validate(bb_commit, BITBUCKET_COMMIT_INFO_SCHEMA)
except Exception as exc:
logger.exception('Exception when validating Bitbucket commit information: %s from %s', exc.message, bb_commit)
raise InvalidPayloadException(exc.message)
commit = JSONPathDict(bb_commit)
@ -216,6 +217,7 @@ def get_transformed_webhook_payload(bb_payload, default_branch=None):
try:
validate(bb_payload, BITBUCKET_WEBHOOK_PAYLOAD_SCHEMA)
except Exception as exc:
logger.exception('Exception when validating Bitbucket webhook payload: %s from %s', exc.message, bb_payload)
raise InvalidPayloadException(exc.message)
payload = JSONPathDict(bb_payload)
@ -298,7 +300,7 @@ class BitbucketBuildTrigger(BuildTriggerHandler):
bitbucket_client = self._get_client()
(result, data, err_msg) = bitbucket_client.get_authorization_url()
if not result:
raise RepositoryReadException(err_msg)
raise TriggerProviderException(err_msg)
return data
@ -545,4 +547,3 @@ class BitbucketBuildTrigger(BuildTriggerHandler):
repository_name, lookup_author)
return self.prepare_build(metadata, is_manual=True)