From 5711416a992a522b549917eaf9bfffd771a81679 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C4=B0nan=C3=A7=20G=C3=BCm=C3=BC=C5=9F?= Date: Wed, 15 May 2024 16:29:31 +0300 Subject: [PATCH] Refactor errorFromDOMError to return err --- common/element_handle.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/common/element_handle.go b/common/element_handle.go index debf301eb..c0ff9e78e 100644 --- a/common/element_handle.go +++ b/common/element_handle.go @@ -1650,11 +1650,11 @@ func errorFromDOMError(v any) error { serr = e case error: if e == nil { - panic("DOM error is nil") + return errors.New("DOM error is nil") } err, serr = e, e.Error() default: - panic(fmt.Errorf("unexpected DOM error type %T", v)) + return fmt.Errorf("unexpected DOM error type %T", v) } var uerr *k6ext.UserFriendlyError if errors.As(err, &uerr) {