Skip to content
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
2 changes: 1 addition & 1 deletion .github/actions/setup-poetry/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ runs:
run: pipx install poetry==${{ inputs.poetry-version }}
shell: bash
- name: Set up Python
uses: actions/setup-python@v5
uses: actions/setup-python@v6
with:
python-version: ${{ inputs.python-version }}
cache: "poetry"
4 changes: 2 additions & 2 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v6
- name: Set up Poetry
uses: ./.github/actions/setup-poetry
- name: Install dependencies
Expand All @@ -24,7 +24,7 @@ jobs:
check-format:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v6
- name: Set up Poetry
uses: ./.github/actions/setup-poetry
- name: Install dependencies
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,15 @@ jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v6
- name: Set up Poetry
uses: ./.github/actions/setup-poetry
- name: Install dependencies
run: poetry install
- name: Build package
run: poetry build --no-interaction
- name: Upload build artifact
uses: actions/upload-artifact@v4
uses: actions/upload-artifact@v7
with:
path: dist/
name: package-dist
Expand All @@ -30,7 +30,7 @@ jobs:
id-token: write
steps:
- name: Download build artifact
uses: actions/download-artifact@v4
uses: actions/download-artifact@v8
with:
path: ${{ github.workspace }}/dist/
name: package-dist
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/sphinx.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
permissions:
contents: write
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v6
with:
persist-credentials: false
- name: Set up Poetry
Expand All @@ -21,12 +21,12 @@ jobs:
- name: Build HTML
run: poetry run make -C docs/ html
- name: Upload artifacts
uses: actions/upload-artifact@v4
uses: actions/upload-artifact@v7
with:
name: html-docs
path: docs/_build/html
- name: Deploy
uses: peaceiris/actions-gh-pages@v3
uses: peaceiris/actions-gh-pages@v4
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: docs/_build/html
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
- "3.10"
fail-fast: false
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v6
- name: Set up Poetry
uses: ./.github/actions/setup-poetry
with:
Expand Down
16 changes: 9 additions & 7 deletions flame_hub/_exceptions.py
Original file line number Diff line number Diff line change
@@ -1,20 +1,22 @@
import typing as t
from json import JSONDecodeError

import httpx
from pydantic import ValidationError, BaseModel, ConfigDict, Field, AliasChoices
from pydantic import ValidationError, BaseModel, ConfigDict


class ErrorResponse(BaseModel):
model_config = ConfigDict(extra="allow")
"""Configuration so that extra properties may be available."""
status_code: t.Annotated[int, Field(validation_alias=AliasChoices("statusCode", "status"))]
"""The status code of the response. This attribute is mapped to the :python:`"statusCode"` or the
:python:`"status"` field of the response."""
name: str
"""Name of the error."""
code: str
"""Written equivalent for ``status_code``."""
"""Name of the error code."""
status_code: int
"""HTTP code of the response."""
message: str
"""The error message."""
issues: list
"""List of issues."""


class HubAPIError(httpx.HTTPError):
Expand Down Expand Up @@ -65,7 +67,7 @@ def new_hub_api_error_from_response(r: httpx.Response) -> HubAPIError:
error_message = f"received status code {r.status_code}"

try:
error_response = ErrorResponse(**r.json())
error_response = ErrorResponse(**({"status_code": r.status_code} | r.json()))
error_message = f"received status code {error_response.status_code} ({error_response.code}): "

if error_response.message.strip() == "":
Expand Down