Skip to content

Commit

Permalink
Merge pull request #78 from neptune-ai/kg/default-error-msgs
Browse files Browse the repository at this point in the history
Make default error callback logs more informative
  • Loading branch information
kgodlewski authored Nov 13, 2024
2 parents 1a2efba + 7f31b94 commit d9c8163
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/neptune_scale/core/components/errors_tracking.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,17 +45,18 @@ def close(self) -> None:


def default_error_callback(error: BaseException, last_seen_at: Optional[float]) -> None:
logger.error(error)
logger.error(f"Terminating the process due to an error: {error}")
kill_me()


def default_network_error_callback(error: BaseException, last_seen_at: Optional[float]) -> None:
logger.warning("Experiencing network issues. Retrying...")
if last_seen_at is None or time.time() - last_seen_at > 5:
logger.warning(f"A network error occurred: {error}. Retrying...")


def default_max_queue_size_exceeded_callback(error: BaseException, last_raised_at: Optional[float]) -> None:
if last_raised_at is None or time.time() - last_raised_at > 5:
logger.warning(error)
logger.warning(f"Pending operations queue size exceeded: {error}. Retrying...")


def default_warning_callback(error: BaseException, last_seen_at: Optional[float]) -> None:
Expand Down Expand Up @@ -114,7 +115,7 @@ def work(self) -> None:
elif isinstance(error, NeptuneAsyncLagThresholdExceeded):
self._on_async_lag_callback()
else:
self._on_error_callback(NeptuneUnexpectedError(reason=str(type(error))), last_raised_at)
self._on_error_callback(NeptuneUnexpectedError(reason=str(error)), last_raised_at)
except Exception as e:
# Don't let user errors kill the process
logger.error(f"An exception occurred in user callback function: {e}")
1 change: 1 addition & 0 deletions src/neptune_scale/exceptions.py
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,7 @@ class NeptuneUnexpectedError(NeptuneScaleError):
message = """
{h1}
----NeptuneUnexpectedError-----------------------------------------------------
Reason: `{reason}`
{end}
An unexpected error occurred in the Neptune Scale client. For help, contact support@neptune.ai. Raw exception name: "{reason}"
Expand Down

0 comments on commit d9c8163

Please # to comment.