fix: itest: check for closed connection

This commit is contained in:
Aayush
2022-09-22 13:58:07 -04:00
parent 5b96496a8d
commit 06262868f5
4 changed files with 23 additions and 17 deletions
+13
View File
@@ -1,6 +1,9 @@
package api
import (
"errors"
"reflect"
"github.com/filecoin-project/go-jsonrpc"
)
@@ -23,6 +26,16 @@ func (e *ErrActorNotFound) Error() string {
var RPCErrors = jsonrpc.NewErrors()
func ErrorIsIn(err error, errorTypes []error) bool {
for _, etype := range errorTypes {
tmp := reflect.New(reflect.PointerTo(reflect.ValueOf(etype).Elem().Type())).Interface()
if errors.As(err, tmp) {
return true
}
}
return false
}
func init() {
RPCErrors.Register(EOutOfGas, new(*ErrOutOfGas))
RPCErrors.Register(EActorNotFound, new(*ErrActorNotFound))