fix(chrome): keep the message of an object console argument

Claude-Session: https://claude.ai/code/session_01ShuAy8q8ZfPi8KHxwc8JpQ
This commit is contained in:
pj committed 2026-08-16 01:29:58 +05:30
1 parent 546c80885e
commit 59da61fecb
1 file changed
+10 -2
+10 -2
View File
@@ -70,7 +70,16 @@ func New() *Driver {
} }
var parts []string var parts []string
for _, arg := range e.Args { for _, arg := range e.Args {
if arg.Value != nil { // An object argument, which is what console.error(err) passes,
// carries no value at all: CDP sends a description instead. Reading
// only the value logged those calls with an empty message, so the
// entry named a level and nothing a reader could act on.
if arg.Value == nil {
if arg.Description != "" {
parts = append(parts, arg.Description)
}
continue
}
var s string var s string
if err := json.Unmarshal(arg.Value, &s); err == nil { if err := json.Unmarshal(arg.Value, &s); err == nil {
parts = append(parts, s) parts = append(parts, s)
@@ -78,7 +87,6 @@ func New() *Driver {
parts = append(parts, string(arg.Value)) parts = append(parts, string(arg.Value))
} }
} }
}
d.logsMu.Lock() d.logsMu.Lock()
d.logs = append(d.logs, driver.LogEntry{ d.logs = append(d.logs, driver.LogEntry{
UnixMillis: int64(e.Timestamp.Time().UnixMilli()), UnixMillis: int64(e.Timestamp.Time().UnixMilli()),