go-conflux-sdk
go-conflux-sdk copied to clipboard
sdk should provide some common way to check specific error
As @boqiu metioned in https://github.com/Conflux-Dev/conflux-infura/pull/69#discussion_r655829246, sdk should provide some common way for client application to check if the return error is some specific error.
epochReceipts, err := cfx.GetEpochReceiptsByPivotBlockHash(pivotHash)
if err != nil {
errStr := strings.ToLower(err.Error())
// pivot hash assumption failed, must be pivot switched
if strings.Contains(errStr, "pivot assumption failed") || strings.Contains(errStr, "block not found") {
// handle pivot switch
}
}
This issue is urgent, and is blocking infura && scan, please take a look and discuss about it.
@Pana @wangdayong228