mirror of
https://github.com/MetaCubeX/mihomo.git
synced 2026-02-26 16:57:08 +00:00
feat: Update to version 1.1
- Add UserNotFound and InvalidParams exception. - The API has changed its data format. - Updated the model to accommodate the new format. - Old format models have been moved to "models.v1". - Use the "fetch_user_v1" function to retrieve data in the old format.
This commit is contained in:
@@ -1,9 +1,19 @@
|
||||
class HttpRequestError(Exception):
|
||||
"""Http request failed"""
|
||||
class BaseException(Exception):
|
||||
"""Base exception class."""
|
||||
|
||||
message: str = ""
|
||||
|
||||
def __init__(self, message: str | None = None, *args: object) -> None:
|
||||
if message is not None:
|
||||
self.message = message
|
||||
super().__init__(self.message, *args)
|
||||
|
||||
|
||||
class HttpRequestError(BaseException):
|
||||
"""Exception raised when an HTTP request fails."""
|
||||
|
||||
status: int = 0
|
||||
reason: str = ""
|
||||
message: str = ""
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
@@ -18,3 +28,15 @@ class HttpRequestError(Exception):
|
||||
self.reason = reason
|
||||
self.message = message
|
||||
super().__init__(message, *args)
|
||||
|
||||
|
||||
class UserNotFound(BaseException):
|
||||
"""Exception raised when a user is not found."""
|
||||
|
||||
message = "User not found."
|
||||
|
||||
|
||||
class InvalidParams(BaseException):
|
||||
"""Exception raised when invalid parameters are provided."""
|
||||
|
||||
message: str = "Invalid parameters"
|
||||
|
||||
Reference in New Issue
Block a user