Skip to content

Add better error reporting in case of wrong data shape #57

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
Jul 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .github/workflows/coverage-diff.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.9"
python-version: "3.12"
- name: "Install dependencies"
run: |
python -m pip install --upgrade pip
Expand All @@ -22,7 +22,7 @@ jobs:
coverage run --source=fingerprint_pro_server_api_sdk -m pytest
coverage xml
- name: Get Cover
uses: orgoro/coverage@d77626a5fa35d39123e86d6c62907fabe2491496
uses: orgoro/coverage@3f13a558c5af7376496aa4848bf0224aead366ac
with:
coverageFile: ./coverage.xml
token: ${{ secrets.GITHUB_TOKEN }}
token: ${{ secrets.GITHUB_TOKEN }}
4 changes: 2 additions & 2 deletions .github/workflows/coverage-report.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.9"
python-version: "3.12"
- name: "Install dependencies"
run: |
python -m pip install --upgrade pip
Expand All @@ -38,4 +38,4 @@ jobs:
uses: JamesIves/github-pages-deploy-action@8817a56e5bfec6e2b08345c81f4d422db53a2cdc
with:
branch: gh-pages
folder: htmlcov
folder: htmlcov
2 changes: 1 addition & 1 deletion .github/workflows/functional_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.9"
python-version: "3.12"
- name: "Install dependencies"
run: |
python -m pip install --upgrade pip
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
with:
appId: ${{ vars.APP_ID }}
language: python
language-version: '3.9'
language-version: '3.12'
semantic-release-extra-plugins: |
semantic-release-pypi@2.5.0
prepare-command: |
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
python-version: [ "3.8", "3.9", "3.10", "3.11", "3.12", "pypy3.10" ]

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "${{ matrix.python-version }}"
Expand Down
18 changes: 12 additions & 6 deletions fingerprint_pro_server_api_sdk/api_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
from fingerprint_pro_server_api_sdk.configuration import Configuration
import fingerprint_pro_server_api_sdk.models
from fingerprint_pro_server_api_sdk import rest
from fingerprint_pro_server_api_sdk.rest import ApiException


class ApiClient(object):
Expand Down Expand Up @@ -161,12 +162,17 @@ def __call_api(
self.last_response = response_data

return_data = response_data
if _preload_content:
# deserialize response data
if response_type:
return_data = self.deserialize(response_data, response_type)
else:
return_data = None
try:
if _preload_content:
# deserialize response data
if response_type:
return_data = self.deserialize(response_data, response_type)
else:
return_data = None
except ValueError as e:
error = ApiException(http_resp=response_data)
error.reason = e
raise error

if _return_http_data_only:
return (return_data)
Expand Down
18 changes: 12 additions & 6 deletions template/api_client.mustache
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import tornado.gen
from {{packageName}}.configuration import Configuration
import {{modelPackage}}
from {{packageName}} import rest
from {{packageName}}.rest import ApiException


class ApiClient(object):
Expand Down Expand Up @@ -159,12 +160,17 @@ class ApiClient(object):
self.last_response = response_data

return_data = response_data
if _preload_content:
# deserialize response data
if response_type:
return_data = self.deserialize(response_data, response_type)
else:
return_data = None
try:
if _preload_content:
# deserialize response data
if response_type:
return_data = self.deserialize(response_data, response_type)
else:
return_data = None
except ValueError as e:
error = ApiException(http_resp=response_data)
error.reason = e
raise error

{{^tornado}}
if _return_http_data_only:
Expand Down
Loading
Loading