Skip to content

Conversation

@EdmondChuiHW
Copy link

Summary

Initially introduced in #74, unhandled errors and rejected Promises are captured.

Generic console.error calls were omitted due to the existing noisy outputs of unimplemented CDP methods.

After discussion with @motiz88 and @hoxyq, we agreed these are still valuable signals on the health of the debugger frontend.

Test plan

  1. Test E2E internally via D58382717
  2. Check CDT release build did not strip away the console calls

Run:

gn gen out/Release

Add this line to out/Release/args.gn, this enables the minifier:

is_official_build=true

Run:

autoninja -C out/Release

Check file:

out/Release/gen/front_end/core/host/host.js

Observe the output follows our intended impl:

registerGlobalErrorReporting(){const e=globalThis.console,r=e[this.#o];e[this.#o]=(...o)=>{try{const e=o[0],[r,t]=W("[RNPerfMetrics] console.error called",e);this.sendEvent({eventName:"Browser.ConsoleError",params:{message:r,error:t}})}catch(e){const[r,o]=W("[RNPerfMetrics] Error handling console.error",e);this.sendEvent({eventName:"Browser.ConsoleError",params:{message:r,error:o}})}finally{r.apply(e,o)}}}

Upstreaming plan

  • This commit should be sent as a patch to the upstream devtools-frontend repo. I've reviewed the contribution guide.
  • This commit is React Native-specific and cannot be upstreamed.

@EdmondChuiHW EdmondChuiHW merged commit 06a25f7 into facebook:main Jun 12, 2024
@EdmondChuiHW EdmondChuiHW deleted the console-errors branch June 12, 2024 15:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants