Skip to content

Commit

Permalink
Merge pull request #7020 from kozlovsky/fix/show_actual_error_on_timeout
Browse files Browse the repository at this point in the history
Show the last error code and error name on timeout in EventRequestManager
  • Loading branch information
kozlovsky authored Aug 29, 2022
2 parents e7756c4 + 045b4c0 commit 33efa3b
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 33efa3b

Please sign in to comment.