Skip to content

Commit

Permalink
Merge pull request #8 from flix-tech/better-error-reporting
Browse files Browse the repository at this point in the history
Better error reporting
  • Loading branch information
jacopofar authored Dec 9, 2024
2 parents 2167a91 + 10090cb commit f5aa331
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 16 deletions.
5 changes: 3 additions & 2 deletions .github/workflows/python-package.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,11 @@ jobs:
fail-fast: false
matrix:
python-version:
- "3.7"
- "3.8"
- "3.9"
- "3.10"
- "3.11"
- "3.12"


steps:
- uses: actions/checkout@v2
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ It takes care of:

It works with [kafka-python][], and extra arguments are forwarded to it.

[kafka-python]: https://github.com/dpkp/kafka-python
[kafka-python]: https://github.com/wbarnha/kafka-python-ng


## Installing
Expand Down
10 changes: 8 additions & 2 deletions kafka_schema_registry/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
from kafka.admin import NewTopic
from kafka.errors import TopicAlreadyExistsError, NoBrokersAvailable
from requests import request
from requests.exceptions import JSONDecodeError

logger = logging.getLogger(__name__)

Expand Down Expand Up @@ -86,9 +87,14 @@ def publish_schemas(
'Content-Type': 'application/json'
}
)
if 'id' not in value_resp.json():
try:
obj = value_resp.json()
except JSONDecodeError:
logger.error(f'Error decoding response: {value_resp.text}')
raise
if 'id' not in obj:
logger.error(f'No id in response: {value_resp.json()}')
value_schema_id = value_resp.json()['id']
value_schema_id = obj['id']

key_schema_id = None
if key_schema is not None:
Expand Down
12 changes: 6 additions & 6 deletions requirements-dev.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
pytest==6.2.5
pytest-cov==3.0.0
flake8==4.0.1
responses==0.17.0
twine==3.7.1
wheel==0.37.1
pytest==8.3.4
pytest-cov==6.0.0
flake8==7.1.1
responses==0.25.3
twine==6.0.1
wheel==0.45.1

6 changes: 3 additions & 3 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
fastavro==1.4.9
kafka-python==2.0.2
requests==2.27.1
fastavro==1.9.7
kafka-python-ng==2.2.3
requests==2.32.3
4 changes: 2 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@
"Changelog": "https://github.com/flix-tech/kafka-schema-registry/blob/master/CHANGELOG.md", # noqa
"Source": 'https://github.com/flix-tech/kafka-schema-registry',
},
python_requires='>=3.7',
python_requires='>=3.9',
install_requires=[
'fastavro',
'kafka-python',
'kafka-python-ng',
'requests',
],
packages=['kafka_schema_registry'],
Expand Down

0 comments on commit f5aa331

Please sign in to comment.