|
19 | 19 | # |
20 | 20 | # derived from https://github.com/verisign/python-confluent-schemaregistry.git |
21 | 21 | # |
| 22 | +import sys |
22 | 23 | import json |
23 | 24 | import logging |
24 | 25 | from collections import defaultdict |
@@ -168,9 +169,9 @@ def get_by_id(self, schema_id): |
168 | 169 | # cache it |
169 | 170 | self._cache_schema(result, schema_id) |
170 | 171 | return result |
171 | | - except: |
| 172 | + except ClientError as e: |
172 | 173 | # bad schema - should not happen |
173 | | - raise ClientError("Received bad schema from registry.") |
| 174 | + raise ClientError("Received bad schema (id %s) from registry: %s" % (schema_id, str(e))) |
174 | 175 |
|
175 | 176 | def get_latest_schema(self, subject): |
176 | 177 | """ |
@@ -204,9 +205,9 @@ def get_latest_schema(self, subject): |
204 | 205 | else: |
205 | 206 | try: |
206 | 207 | schema = loads(result['schema']) |
207 | | - except: |
| 208 | + except ClientError: |
208 | 209 | # bad schema - should not happen |
209 | | - raise ClientError("Received bad schema from registry.") |
| 210 | + raise |
210 | 211 |
|
211 | 212 | self._cache_schema(schema, schema_id, subject, version) |
212 | 213 | return (schema_id, schema, version) |
@@ -269,7 +270,8 @@ def test_compatibility(self, subject, avro_schema, version='latest'): |
269 | 270 | else: |
270 | 271 | log.error("Unable to check the compatibility") |
271 | 272 | False |
272 | | - except: |
| 273 | + except: # noqa |
| 274 | + log.error("_send_request() failed: %s" % sys.exc_info()[0]) |
273 | 275 | return False |
274 | 276 |
|
275 | 277 | def update_compatibility(self, level, subject=None): |
|
0 commit comments