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
5 changes: 5 additions & 0 deletions sagemcom_api/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@
UnauthorizedException,
UnknownException,
UnknownPathException,
UnsupportedHostException,
)
from .models import Device, DeviceInfo, PortMapping

Expand Down Expand Up @@ -203,6 +204,10 @@ async def __post(self, url, data):
result = await response.text()
raise BadRequestException(result)

if response.status == 404:
result = await response.text()
raise UnsupportedHostException(result)

if response.status != 200:
result = await response.text()
raise UnknownException(result)
Expand Down
4 changes: 4 additions & 0 deletions sagemcom_api/exceptions.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@ class UnknownException(BaseSagemcomException):
"""Unknown exception."""


class UnsupportedHostException(BaseSagemcomException):
"""Raised when API is not available on given host."""


# Exceptions provided by SagemCom API
class AccessRestrictionException(BaseSagemcomException):
"""Raised when current user has access restrictions."""
Expand Down