tweaking network error handling, updating ci
This commit is contained in:
parent
9212a0a4ce
commit
98debaf22a
12
.github/workflows/ci.yml
vendored
12
.github/workflows/ci.yml
vendored
@ -6,20 +6,20 @@ jobs:
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
python-version: [3.8]
|
||||
poetry-version: [1.1.4]
|
||||
os: [ubuntu-20.04, macos-latest, windows-latest]
|
||||
python-version: [3.10]
|
||||
poetry-version: [1.3.1]
|
||||
os: [ubuntu-latest]
|
||||
runs-on: ${{ matrix.os }}
|
||||
steps:
|
||||
- uses: actions/checkout@v2 # get source
|
||||
- uses: actions/checkout@v3 # get source
|
||||
|
||||
- name: Install Python 3
|
||||
uses: actions/setup-python@v2
|
||||
uses: actions/setup-python@v4
|
||||
with:
|
||||
python-version: ${{ matrix.python-version }}
|
||||
|
||||
- name: Install Poetry # dependency management
|
||||
uses: abatilo/actions-poetry@v2.1.0
|
||||
uses: abatilo/actions-poetry@v2.1.6
|
||||
with:
|
||||
poetry-version: ${{ matrix.poetry-version }}
|
||||
|
||||
|
@ -170,9 +170,12 @@ class Network:
|
||||
logger.critical(f'{method} {url_path or whole_url} refresh token limit (5) reached')
|
||||
|
||||
try:
|
||||
error_json = response.json()["error"]
|
||||
logger.error(f'{method} {response.status_code} {error_json["message"]}')
|
||||
raise SpotifyNetworkException(http_code=response.status_code, message=error_json["message"])
|
||||
error_json = response.json()
|
||||
error_message = error_json.get("error", {}).get("message", error_json)
|
||||
|
||||
logger.error(f'{method} {response.status_code} {error_message}')
|
||||
raise SpotifyNetworkException(http_code=response.status_code, message=error_message)
|
||||
|
||||
except (KeyError, JSONDecodeError):
|
||||
logger.error(f'{method} {response.status_code} no error object found')
|
||||
raise SpotifyNetworkException(http_code=response.status_code, message=response.text)
|
||||
|
Loading…
Reference in New Issue
Block a user