def _fn(*args, **kwargs): from dagster_graphql.schema.errors import DauphinPythonError try: return fn(*args, **kwargs) except UserFacingGraphQLError as de_exception: return de_exception.dauphin_error except Exception: # pylint: disable=broad-except return DauphinPythonError(serializable_error_info_from_exc_info(sys.exc_info()))
def test_python_error(): def func(): raise Exception('bar') try: func() except: # pylint: disable=W0702 python_error = DauphinPythonError(serializable_error_info_from_exc_info(sys.exc_info())) assert python_error assert isinstance(python_error.message, str) assert isinstance(python_error.stack, list) assert len(python_error.stack) == 2 assert 'bar' in python_error.stack[1]
def __init__(self, daemon_status): check.inst_param(daemon_status, "daemon_status", DaemonStatus) super(DauphinDaemonStatus, self).__init__( daemonType=daemon_status.daemon_type, required=daemon_status.required, healthy=daemon_status.healthy, lastHeartbeatTime=daemon_status.last_heartbeat.timestamp if daemon_status.last_heartbeat else None, lastHeartbeatErrors=[ DauphinPythonError(error) for error in daemon_status.last_heartbeat.errors ] if daemon_status.last_heartbeat else [], )
def __init__(self, name, error): check.str_param(name, "name") check.inst_param(error, "error", SerializableErrorInfo) super(DauphinRepositoryLocationLoadFailure, self).__init__( name=name, error=DauphinPythonError(error) )