From d1d458462d0e86d59628d9b2706488dd6be28866 Mon Sep 17 00:00:00 2001 From: Jhoan Lopez Date: Wed, 8 Jul 2026 22:39:17 -0500 Subject: [PATCH] fix: show script exception text instead of empty message --- clicker/internal/bidi/script.go | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/clicker/internal/bidi/script.go b/clicker/internal/bidi/script.go index 1493f76..e70cd3a 100644 --- a/clicker/internal/bidi/script.go +++ b/clicker/internal/bidi/script.go @@ -81,13 +81,16 @@ func (c *Client) Evaluate(context, expression string) (interface{}, error) { var evalResult struct { Type string `json:"type"` Result json.RawMessage `json:"result"` + ExceptionDetails struct { + Text string `json:"text"` + } `json:"exceptionDetails"` } if err := json.Unmarshal(msg.Result, &evalResult); err != nil { return nil, fmt.Errorf("failed to parse script.evaluate result: %w", err) } if evalResult.Type == "exception" { - return nil, fmt.Errorf("script exception: %s", string(evalResult.Result)) + return nil, fmt.Errorf("script exception: %s", evalResult.ExceptionDetails.Text) } // Parse the remote value @@ -137,13 +140,16 @@ func (c *Client) CallFunction(context, functionDeclaration string, args []interf var callResult struct { Type string `json:"type"` Result json.RawMessage `json:"result"` + ExceptionDetails struct { + Text string `json:"text"` + } `json:"exceptionDetails"` } if err := json.Unmarshal(msg.Result, &callResult); err != nil { return nil, fmt.Errorf("failed to parse script.callFunction result: %w", err) } if callResult.Type == "exception" { - return nil, fmt.Errorf("script exception: %s", string(callResult.Result)) + return nil, fmt.Errorf("script exception: %s", callResult.ExceptionDetails.Text) } // Parse the remote value