Skip to content
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

Add NotFound error exception #72

Merged
merged 1 commit into from
Dec 20, 2023
Merged
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
Add NotFound error exception
Skaronator committed Dec 16, 2023

Verified

This commit was signed with the committer’s verified signature.
purajit purajit
commit 923864c9a97804c9d69bab8c75063fa097ad342e
5 changes: 4 additions & 1 deletion pyprusalink/client.py
Original file line number Diff line number Diff line change
@@ -6,7 +6,7 @@
import hashlib

from aiohttp import ClientResponse, ClientSession
from pyprusalink.types import Conflict, InvalidAuth
from pyprusalink.types import Conflict, InvalidAuth, NotFound


class ApiClient:
@@ -82,5 +82,8 @@ async def request(
if response.status == 409:
raise Conflict()

if response.status == 404:
raise NotFound()

response.raise_for_status()
yield response
4 changes: 4 additions & 0 deletions pyprusalink/types.py
Original file line number Diff line number Diff line change
@@ -16,6 +16,10 @@ class Conflict(PrusaLinkError):
"""Error to indicate the command hit a conflict."""


class NotFound(PrusaLinkError):
"""Error to indicate the requested resource was not found. (404)"""


class Capabilities(TypedDict):
"""API Capabilities"""