Skip to content

Commit

Permalink
normalize error messages for property access on null/undefined
Browse files Browse the repository at this point in the history
  • Loading branch information
ZekeLu committed Oct 18, 2021
1 parent 3f81ff8 commit ded6f35
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion example_test.go
Expand Up @@ -255,6 +255,11 @@ func ExampleListenTarget_consoleLog() {
// Since ts.URL uses a random port, replace it.
s := ev.ExceptionDetails.Error()
s = strings.ReplaceAll(s, ts.URL, "<server>")
// V8 has changed the error messages for property access on null/undefined in version 9.3.310.
// see: https://chromium.googlesource.com/v8/v8/+/c0fd89c3c089e888c4f4e8582e56db7066fa779b
// https://github.com/chromium/chromium/commit/1735cbf94c98c70ff7554a1e9e01bb9a4f91beb6
// The message is normalized to make it compatible with the versions before this change.
s = strings.ReplaceAll(s, "Cannot read property 'throwsException' of null", "Cannot read properties of null (reading 'throwsException')")
fmt.Printf("* %s\n", s)
gotException <- true
}
Expand All @@ -271,7 +276,7 @@ func ExampleListenTarget_consoleLog() {
// * console.warning call:
// string - "scary warning"
// number - 123
// * exception "Uncaught" (4:6): TypeError: Cannot read property 'throwsException' of null
// * exception "Uncaught" (4:6): TypeError: Cannot read properties of null (reading 'throwsException')
// at <server>/:5:7
}

Expand Down

0 comments on commit ded6f35

Please sign in to comment.