Disclosure Statement: This site contains affiliate links, which means that I may receive a commission if you make a purchase using these links. As an eBay Partner, I earn from qualifying purchases.

Get error on JS ?

Post Reply
thefunkyjoint
Posts: 460
Joined: Thu Aug 10, 2017 12:40 pm

Get error on JS ?

Post 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
User avatar
salvadordf
Posts: 4056
Joined: Thu Feb 02, 2017 12:24 pm
Location: Spain
Contact:

Re: Get error on JS ?

Post 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.
  ///
Post Reply