How should we handle exception that are not part of standard error list?

Ketan asked on November 6, 2018

Team,
 
We are getting wired exception on browser console. Please find attach snapshot. Its not getting caught under any of the standard error handler as per API documentation.
loadingreportfile, reportfileerror, queryerror, dataerror
We have placed flexmonster intialization block inside try catch but fail to catch any exception.
Do you have any other global error handler? Please suggest approach to handle such sort of error.
 

10 answers

Public
Dmytro Zvazhii Flexmonster November 6, 2018

Hello Ketan,
Thank you for writing. It seems that the described exception is some sort of the unchecked exceptions. 
Could you please provide us with the code examples and steps for reproducing? That will definitely help us in our further investigation.
Waiting to hear from you.
Regards,
Dmytro

Public
Ketan November 6, 2018

Sure. i will certainly provide steps with sample. It will take sometimes.
 
Can you provide global error handler for all uncaught exception? It will help in great as we have many flexmonster instances running on dashboard loading sequenclly one after another. If any one of them fail, rest of them fails. 

Public
Dmytro Zvazhii Flexmonster November 8, 2018

Hi Ketan! 
Could you try the following approach?
   <script type="text/javascript">
      window.onerror = function() {
         alert("Error here!");
      };
      // --- your code here --- //
   </script>

 
Does it work for you?
 
Thanks,
  Dmytro

Public
Ketan November 11, 2018

Hi Dmytro Zvazhii,
Thanks for suggestion. Window.error is caching desire error but getting difference error message on each new fm instance, making error handling difficult.
 
Few examples –
Uncaught TypeError: Cannot read property ‘414’ of undefined
Uncaught TypeError: Cannot read property ‘415’ of undefined
Uncaught TypeError: Cannot read property ‘418’ of undefined

Please find attached report and data files.

Attachments:
report.json
sample.csv

Public
Dmytro Zvazhii Flexmonster November 12, 2018

Hello Ketan,
Thank you for providing us with examples. They were really helpful.
 
We have looked through the report.json file and found that Total Suspended Solids in STP mg calculated value is referring to the none existing field Outlet Quantity in mg. There is no such field in the data source and that is why the error occurs. You can replace that field with the correct one and everything should work fine.
 
Also, we decided to make the improvement which should make the component notify the user about such sort of issue. In such case, it would be much easier to handle the issue.
Our dev team will release the improvement in the minor release on ETA Dec 3.
We will keep you updated.
 
Please let us know in case you need any other assistance.
Regards,
Dmytro

Public
Ketan November 12, 2018

Thanks for update. This will definitely help. Will you be handling it under reportfileerror API?
As earlier mention, we are looking for top level global flexmonster error handling API. We are initialising next flexmonster instance when first one finished. In case of failure, it will not load subsequencial instances.

Public
Dmytro Zvazhii Flexmonster November 13, 2018

Hello Ketan,
Thank you for your feedback.
We are not going to handle it under reportfileerror, since that event is for handling report loading errors. The error which was mentioned above occurs after the report was successfully loaded.
As for the global top lever error handling API, we do not have it in our roadmap right now. Please consider putting the creation process under the try and catch block. That should allow you skipping some instances if an error occurred.
Please let us know in case of any other question.
Regards,
Dmytro
 

Public
Ketan November 16, 2018

Hi Dmytro,
We have considered try and catch as our first approach but as mention earlier “We have placed flexmonster intialization block inside try catch but fail to catch any exception”, that is why we need some callback which handles flexmonster internal errors.
As you can observe in the screen shot provided in the question it does not trace back my application code, hence can not use try catch in this scenario.

Public
Dmytro Zvazhii Flexmonster November 19, 2018

Hello Ketan,
Thank you for writing.
 
Flexmonster consists of many different modules and some of them have asynchronous behavior. Such type of behavior can be the reason why it is not possible to handle some errors with the try catch block.

We do agree that the correct mechanism for handling Flexmonster’s errors is the right solution for such cases. Therefore, we are going to add your request to our Customer’s wish list. However, the implementation of such a mechanism is a very time-consuming task. Right now I am not ready to provide you with the ETA since such complex tasks need to be approved by the management. We will notify you when it is added to our roadmap.

Please let us know in case there is anything else we can help you with.
Regards,
Dmytro

Public
Dmytro Zvazhii Flexmonster December 4, 2018

Hello Ketan,
We are glad to inform you that the new version of the component has already been released.
Now, the component shows the warning pop-up if there was a mistake in the formula.
You are welcome to try the latest version.
Regards,
Dmyrto

Please login or Register to Submit Answer