Fix or prevent "Script Error" display

Asked

Viewed 657 times

0

In the Delphi i call an HTML page that displays some graphics made with jChartFX within a TWebBrowser, are working normally, but when clicking on any chart it shows me this alert Script Error:

inserir a descrição da imagem aqui

I would like to know if via code there is any way I can prevent these alerts from appearing or if there is any solution to this error specifically.

The graphics are working correctly, but when you click on a bar or a slice of the donut, for example, it keeps showing this alert and it’s really boring.

  • 1

    Brow put a try/ catch around the function that calls the graph. But you probably need to fix the code because it’s asynchronous to the function that calls the chart once it waits for the click.

  • 2

    This is a browser configuration (internet explorer), and I’ve known for a few years that it’s been turned off by default. It must be enabled in your machine because it is a development environment. Anyway, I agree with @Sergio, the way is to avoid the mistake, not try to hide the message.

2 answers

2

Check if there is any occurrence where the object is Undefined or another object type not supported by the methods you are trying to use. Does console logs. of the object, use JSON.stringify if necessary to verify this.

Another thing that could be, is to make sure that the object you’re clicking on is actually created before you try to use it. It’s usually a fairly common mistake that we overlook.

  • Amazingly, it was just a problem of case sensitive. the function was being called as bi and it was actually bi rs

0

I managed to fix it. It was a problem of case sensitive. I looked at the console and it was showing:

Typeerror: "bi" is not a Function

So I looked at the link Leia mais that it shows and there said that it can happen by problem of case sensitive. I did a code search and saw that on the informed line the function was actually bi and not bI.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.