-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #4 from YongSangUn/error_handler
refactor: func call() for better error handling; now returns single d…
- Loading branch information
Showing
6 changed files
with
296 additions
and
70 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,36 @@ | ||
# -*- coding: utf-8 -*- | ||
|
||
__version__ = "0.0.1" | ||
__version__ = "0.0.2" | ||
|
||
from .base import QcloudBase | ||
from .config import Config | ||
from .services import Services | ||
|
||
from .exceptions import ( | ||
ServiceError, | ||
ServiceJsonNotFoundError, | ||
ServiceJsonLoadError, | ||
APIError, | ||
AuthenticationError, | ||
ClientError, | ||
ConfigError, | ||
AuthenticationError, | ||
QcloudWrapperError, | ||
ServerError, | ||
ServiceDefinitionError, | ||
ServiceDiscoveryError, | ||
ServiceNotFoundError, | ||
) | ||
from .logging import logger, setup_logging | ||
from .services import Services | ||
|
||
from .logging import logger | ||
__all__ = [ | ||
"QcloudBase", | ||
"Config", | ||
"Services", | ||
"QcloudWrapperError", | ||
"ConfigError", | ||
"AuthenticationError", | ||
"ServiceDiscoveryError", | ||
"ServiceNotFoundError", | ||
"ServiceDefinitionError", | ||
"APIError", | ||
"ClientError", | ||
"ServerError", | ||
"logger", | ||
"setup_logging", | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,68 @@ | ||
# -*- coding: utf-8 -*- | ||
|
||
|
||
class ServiceError(Exception): | ||
class QcloudWrapperError(Exception): | ||
"""Base exception class for all qcloud-sdk-python-wrapper errors.""" | ||
|
||
pass | ||
|
||
|
||
class ConfigError(QcloudWrapperError): | ||
"""Raised for errors related to client configuration.""" | ||
|
||
pass | ||
|
||
|
||
class ServiceJsonNotFoundError(ServiceError): | ||
class AuthenticationError(ConfigError): | ||
"""Raised for authentication-related errors.""" | ||
|
||
pass | ||
|
||
|
||
class ServiceJsonLoadError(ServiceError): | ||
class ServiceDiscoveryError(QcloudWrapperError): | ||
"""Raised for errors during service discovery.""" | ||
|
||
pass | ||
|
||
|
||
class ClientError(Exception): | ||
class ServiceNotFoundError(ServiceDiscoveryError): | ||
"""Raised when the requested Tencent Cloud service is not found.""" | ||
|
||
pass | ||
|
||
|
||
class ConfigError(ClientError): | ||
class ServiceDefinitionError(ServiceDiscoveryError): | ||
"""Raised when there are errors in the service definition.""" | ||
|
||
pass | ||
|
||
|
||
class AuthenticationError(ConfigError): | ||
class APIError(QcloudWrapperError): | ||
"""Base exception class for Tencent Cloud API call errors.""" | ||
|
||
pass | ||
|
||
|
||
class ClientError(APIError): | ||
"""Raised for client-side errors during API calls.""" | ||
|
||
pass | ||
|
||
|
||
class ServerError(APIError): | ||
"""Raised for errors originating from the Tencent Cloud server.""" | ||
|
||
def __init__(self, message, request_id=None): | ||
super().__init__(message) | ||
self._request_id = request_id | ||
|
||
@property | ||
def request_id(self): | ||
"""str: The request ID returned by the Tencent Cloud API (if available).""" | ||
return self._request_id | ||
|
||
|
||
class LoggingError(QcloudWrapperError): | ||
"""Raised for errors related to logging.""" | ||
|
||
pass |
Oops, something went wrong.