Fix IndexError for reasons. (#4656)

* Fix IndexError for reasons.

* Deprecate specific Timeout reason.
Log exception message instead of single Timeout error.
This commit is contained in:
Eugene Kabanov 2023-02-23 18:02:17 +02:00 committed by GitHub
parent 8f269c92d7
commit dd911a7ac6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 7 additions and 3 deletions

View File

@ -268,9 +268,11 @@ proc getNodeCounts*(vc: ValidatorClientRef): BeaconNodesCounters =
proc getFailureReason*(exc: ref ValidatorApiError): string =
var counts: array[int(high(ApiFailure)) + 1, int]
let errors = exc[].data
let
errors = exc[].data
errorsCount = len(errors)
if len(errors) > 1:
if errorsCount > 1:
var maxFailure =
block:
var maxCount = -1
@ -282,8 +284,10 @@ proc getFailureReason*(exc: ref ValidatorApiError): string =
res = item.failure
res
$maxFailure
else:
elif errorsCount == 1:
$errors[0].failure
else:
exc.msg
proc shortLog*(roles: set[BeaconNodeRole]): string =
var r = "AGBSD"