Rockbox open source high quality audio player as a Music Player Daemon
mpris
rockbox
mpd
libadwaita
audio
rust
zig
deno
1"""Exception hierarchy for the Rockbox SDK."""
2
3from __future__ import annotations
4
5from typing import Any
6
7
8class RockboxError(Exception):
9 """Base error for everything the SDK raises."""
10
11 def __init__(self, message: str, cause: Exception | None = None) -> None:
12 super().__init__(message)
13 self.message = message
14 self.cause = cause
15
16
17class RockboxNetworkError(RockboxError):
18 """Raised when the SDK cannot reach the rockboxd HTTP/WS endpoint."""
19
20
21class RockboxGraphQLError(RockboxError):
22 """Raised when the server returns a non-empty `errors` array."""
23
24 def __init__(self, errors: list[dict[str, Any]]) -> None:
25 self.errors = errors
26 super().__init__("; ".join(str(e.get("message", e)) for e in errors))