Page 1 of 1

Get error on JS ?

Posted: Tue Mar 17, 2020 12:43 am
by thefunkyjoint
Hi,

How can i intercept errors that occur when i run a JS code ? It seems OnConsoleMessage won't intercept errors.

For instance, if i run this code below in Chrome :

Code: Select all

car foo="bar";
I will get this :

Code: Select all

VM44:1 Uncaught SyntaxError: Unexpected identifier
How can i get the error above in Cef4Delphi ?

Thanks

Re: Get error on JS ?

Posted: Tue Mar 17, 2020 8:10 am
by salvadordf
Hi,

Maybe you can catch it with GlobalCEFApp.OnUncaughtException but that event is executed in the render process and you also have to set GlobalCEFApp.UncaughtExceptionStackSize to any value bigger than zero to enable that event.

These are the code comments for that event :

Code: Select all

  ///
  // Called for global uncaught exceptions in a frame. Execution of this
  // callback is disabled by default. To enable set
  // CefSettings.uncaught_exception_stack_size > 0.
  ///