mirror of
https://github.com/sotam0316/docker-py-revanced.git
synced 2026-04-25 03:48:37 +09:00
🎨 Updated error message (#345)
This commit is contained in:
+2
-2
@@ -9,7 +9,7 @@ from loguru import logger
|
||||
|
||||
from src.config import RevancedConfig
|
||||
from src.downloader.sources import apk_sources
|
||||
from src.exceptions import DownloadError, PatchingFailedError, UnknownError
|
||||
from src.exceptions import BuilderError, DownloadError, PatchingFailedError
|
||||
from src.utils import slugify
|
||||
|
||||
|
||||
@@ -151,7 +151,7 @@ class APP(object):
|
||||
for resource_name, future in futures.items():
|
||||
try:
|
||||
self.resource[resource_name] = future.result()
|
||||
except UnknownError as e:
|
||||
except BuilderError as e:
|
||||
raise PatchingFailedError(e) from e
|
||||
|
||||
@staticmethod
|
||||
|
||||
+25
-9
@@ -2,7 +2,17 @@
|
||||
from typing import Any, Self
|
||||
|
||||
|
||||
class APKMirrorIconScrapError(Exception):
|
||||
class BuilderError(Exception):
|
||||
"""Base class for all the project errors."""
|
||||
|
||||
message = "Default Error message."
|
||||
|
||||
def __str__(self: Self) -> str:
|
||||
"""Return error message."""
|
||||
return self.message
|
||||
|
||||
|
||||
class APKMirrorIconScrapError(BuilderError):
|
||||
"""Exception raised when the icon cannot be scraped from apkmirror."""
|
||||
|
||||
def __init__(self: Self, *args: Any, **kwargs: Any) -> None:
|
||||
@@ -30,11 +40,11 @@ class APKMonkIconScrapError(APKMirrorIconScrapError):
|
||||
"""Exception raised when the icon cannot be scraped from apkmonk."""
|
||||
|
||||
|
||||
class DownloadError(Exception):
|
||||
class DownloadError(BuilderError):
|
||||
"""Generic Download failure."""
|
||||
|
||||
def __init__(self: Self, *args: Any, **kwargs: Any) -> None:
|
||||
"""Initialize the APKMirrorAPKDownloadFailure exception.
|
||||
"""Initialize the DownloadFailure exception.
|
||||
|
||||
Args:
|
||||
----
|
||||
@@ -45,6 +55,11 @@ class DownloadError(Exception):
|
||||
super().__init__(*args)
|
||||
self.url = kwargs.get("url", None)
|
||||
|
||||
def __str__(self: Self) -> str:
|
||||
"""Exception message."""
|
||||
base_message = super().__str__()
|
||||
return f"Message - {base_message} Url - {self.url}"
|
||||
|
||||
|
||||
class APKDownloadError(DownloadError):
|
||||
"""Exception raised when the apk cannot be scraped."""
|
||||
@@ -74,15 +89,15 @@ class APKSosAPKDownloadError(APKDownloadError):
|
||||
"""Exception raised when downloading an APK from apksos failed."""
|
||||
|
||||
|
||||
class PatchingFailedError(Exception):
|
||||
class PatchingFailedError(BuilderError):
|
||||
"""Patching Failed."""
|
||||
|
||||
|
||||
class AppNotFoundError(ValueError):
|
||||
class AppNotFoundError(BuilderError):
|
||||
"""Not a valid Revanced App."""
|
||||
|
||||
|
||||
class PatchesJsonLoadError(ValueError):
|
||||
class PatchesJsonLoadError(BuilderError):
|
||||
"""Failed to load patches json."""
|
||||
|
||||
def __init__(self: Self, *args: Any, **kwargs: Any) -> None:
|
||||
@@ -97,6 +112,7 @@ class PatchesJsonLoadError(ValueError):
|
||||
super().__init__(*args)
|
||||
self.file_name = kwargs.get("file_name", None)
|
||||
|
||||
|
||||
class UnknownError(Exception):
|
||||
"""Some unknown error."""
|
||||
def __str__(self: Self) -> str:
|
||||
"""Exception message."""
|
||||
base_message = super().__str__()
|
||||
return f"Message - {base_message} Url - {self.file_name}"
|
||||
|
||||
Reference in New Issue
Block a user