Skip to content

Commit

Permalink
Show the last error code and name on timeout in EventRequestManager
Browse files Browse the repository at this point in the history
  • Loading branch information
kozlovsky committed Aug 29, 2022
1 parent e7756c4 commit 045b4c0
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/tribler/gui/event_request_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,14 +116,16 @@ def on_error(self, error: int, reschedule_on_err: bool):
should_retry = reschedule_on_err and time.time() < self.start_time + CORE_CONNECTION_TIMEOUT
error_name = self.network_errors.get(error, error)
self._logger.info(f"Error {error_name} while trying to connect to Tribler Core"
+ (', will retry...' if should_retry else ''))
+ (', will retry' if should_retry else ', will not retry'))

if reschedule_on_err:
if should_retry:
self.connect_timer.start(RECONNECT_INTERVAL_MS) # Reschedule an attempt
else:
raise CoreConnectTimeoutError(
f"Could not connect with the Tribler Core within {CORE_CONNECTION_TIMEOUT} seconds")
f"Could not connect with the Tribler Core within {CORE_CONNECTION_TIMEOUT} seconds: "
f"{error_name} (code {error})"
)

def on_read_data(self):
if not self.receiving_data:
Expand Down

0 comments on commit 045b4c0

Please sign in to comment.