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:
parent
8f269c92d7
commit
dd911a7ac6
|
@ -268,9 +268,11 @@ proc getNodeCounts*(vc: ValidatorClientRef): BeaconNodesCounters =
|
||||||
|
|
||||||
proc getFailureReason*(exc: ref ValidatorApiError): string =
|
proc getFailureReason*(exc: ref ValidatorApiError): string =
|
||||||
var counts: array[int(high(ApiFailure)) + 1, int]
|
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 =
|
var maxFailure =
|
||||||
block:
|
block:
|
||||||
var maxCount = -1
|
var maxCount = -1
|
||||||
|
@ -282,8 +284,10 @@ proc getFailureReason*(exc: ref ValidatorApiError): string =
|
||||||
res = item.failure
|
res = item.failure
|
||||||
res
|
res
|
||||||
$maxFailure
|
$maxFailure
|
||||||
else:
|
elif errorsCount == 1:
|
||||||
$errors[0].failure
|
$errors[0].failure
|
||||||
|
else:
|
||||||
|
exc.msg
|
||||||
|
|
||||||
proc shortLog*(roles: set[BeaconNodeRole]): string =
|
proc shortLog*(roles: set[BeaconNodeRole]): string =
|
||||||
var r = "AGBSD"
|
var r = "AGBSD"
|
||||||
|
|
Loading…
Reference in New Issue