enhancing logging (#23332)
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
This commit is contained in:
@@ -208,6 +208,7 @@ class BasePluginClient:
|
|||||||
except Exception:
|
except Exception:
|
||||||
raise PluginDaemonInnerError(code=rep.code, message=rep.message)
|
raise PluginDaemonInnerError(code=rep.code, message=rep.message)
|
||||||
|
|
||||||
|
logger.error("Error in stream reponse for plugin %s", rep.__dict__)
|
||||||
self._handle_plugin_daemon_error(error.error_type, error.message)
|
self._handle_plugin_daemon_error(error.error_type, error.message)
|
||||||
raise ValueError(f"plugin daemon: {rep.message}, code: {rep.code}")
|
raise ValueError(f"plugin daemon: {rep.message}, code: {rep.code}")
|
||||||
if rep.data is None:
|
if rep.data is None:
|
||||||
|
@@ -2,6 +2,8 @@ from collections.abc import Mapping
|
|||||||
|
|
||||||
from pydantic import TypeAdapter
|
from pydantic import TypeAdapter
|
||||||
|
|
||||||
|
from extensions.ext_logging import get_request_id
|
||||||
|
|
||||||
|
|
||||||
class PluginDaemonError(Exception):
|
class PluginDaemonError(Exception):
|
||||||
"""Base class for all plugin daemon errors."""
|
"""Base class for all plugin daemon errors."""
|
||||||
@@ -11,7 +13,7 @@ class PluginDaemonError(Exception):
|
|||||||
|
|
||||||
def __str__(self) -> str:
|
def __str__(self) -> str:
|
||||||
# returns the class name and description
|
# returns the class name and description
|
||||||
return f"{self.__class__.__name__}: {self.description}"
|
return f"req_id: {get_request_id()} {self.__class__.__name__}: {self.description}"
|
||||||
|
|
||||||
|
|
||||||
class PluginDaemonInternalError(PluginDaemonError):
|
class PluginDaemonInternalError(PluginDaemonError):
|
||||||
|
Reference in New Issue
Block a user