gatsbyjs / gatsby

The best React-based framework with performance, scalability and security built in.
https://www.gatsbyjs.com
MIT License
55.24k stars 10.32k forks source link

[Head API]: Fixed runtime crash of monkey-patched console.error #39020

Open JustFly1984 opened 3 months ago

JustFly1984 commented 3 months ago

I've encountered an error in monkey-patched console.error. Monkey-patching native functions is bad practice in general, but in this case, I got unexpected runtime crash while handling a failed case of try catch in my code.

I've added try/catch block inside the monkey-patched function, so it handles errors gracefully.

Please review.

This is first of the series of PR I'm making, based on my previous research and huge PR

JustFly1984 commented 1 month ago

@pieh @emmron Please please please merge my PR