We have updated Flexmonster Software License Agreement, effective as of September 30, 2024. Learn more about what’s changed.

How to customize error popup when loading report from Elastic Search?

Answered
uchivoitachi asked on January 7, 2022

Hello Team,
 
Currently we're using Flexmonster + React + Typescript + Elastic Search, the data is stored at ES and shown in Flexmonster, recently we encountered a werid issue that the ES thrown "503 Service Unavailable" error, but Flexmonster prompt a Error dialog without any error message(see attached jpg file)
 
ES Node:/backend/{es index}/_search
error in backend:
{"error":{"root_cause":[],"type":"search_phase_execution_exception","reason":"","phase":"fetch","grouped":true,"failed_shards":[],"caused_by":{"type":"too_many_buckets_exception","reason":"Trying to create too many buckets. Must be less than or equal to: [65536] but was [65537]. This limit can be set by changing the [search.max_buckets] cluster level setting.","max_buckets":65536}},"status":503}
 
We're wondering if Flexmonster natively support customize the Error window when backend throws such kind of error?
 
For example, when fetching data via Elastic Search API({index}/_search), it may prompt Unavalible Service error in backend, but Flexmonster itself seems couldn't catch the error message right,in this case,it's an empty error window.
 
Many thanks.

Attachments:
error 1.jpg

12 answers

Public
uchivoitachi January 7, 2022

Or what kind of message returned from backend to flexmonster will be displayed on the Error window?
 
thanks

Public
Vera Didenko Vera Didenko Flexmonster January 10, 2022

Hello,
 
Thank you for writing to us.
 
We managed to reproduce a similar behavior on our end. It seems Elasticsearch errors are not fully parsed; therefore, a general "empty" error pop-up is displayed. Our team will look into this issue in more detail and we will provide a fix with ETA 7th of February.
 
In the meantime, as a workaround, you could customize the default error pop-up in the following way:

  1. Listen to the olapstructureerror and queryerror events. These events will trigger if Elasticsearch responds with an error.
  2. Once the olapstructureerror or queryerror events fire, use Flexmonster's alert() API call to override the default error pop-up message.
  3. We prepared a simple JSFiddle for illustration: https://jsfiddle.net/flexmonster/kLdtq3wm/.

 
Please let us know if this would work for you.
 
Kind regards,
Vera

Public
uchivoitachi January 11, 2022

Thanks!
We'll try to apply the workaround.

Public
uchivoitachi January 11, 2022

Hi,
 
The workaround is useful to override the default error pop-up, but can it be hidden since we want to show our own message bar when there's an error during data fetching?
 
Thanks alot.

Public
Vera Didenko Vera Didenko Flexmonster January 11, 2022

Hello, 
 
Thank you for your reply.
 
Yes, you can hide Flexmonster pop-ups via CSS.
Here is a JSFiddle for demonstration: https://jsfiddle.net/flexmonster/u7w8rbgd/.
In the example, the error pop-ups are hidden via CSS when an error event is triggered, and a custom message is shown instead.
 
Please let us know if this helps.
 
Kind regards,
Vera

Public
uchivoitachi January 12, 2022

thanks I've hidden it via CSS control.

Public
uchivoitachi January 16, 2022

Hello,
 
Here want to update that the error server-side message has been shown successfully after we add config items for spring boot:

server:
error:
include-message: always
include-binding-errors: always

Attached the screenshot error 2.png
 
However, as mentioned in previous post, we want to display the error message in our own message bar, to achieve this we need to get the server-side error message correctly, is there an approach to get it? Please be informed that the error was occurred during fetching data via a elastic search api(/{backend}/{es index}/_search in this case), the whole process is done within flexmonster.full.js so I can't get the error message
 
thanks.

Attachments:
error 2.png

Public
Vera Didenko Vera Didenko Flexmonster January 18, 2022

Hello,
 
Thank you for the update.
 
We are happy to hear that you found a way to pass and display the error message in Flexmonster.
As mentioned before, our team will also check and enhance the error handling process on our end with the ETA 7th of February.
 
As for a way to retrieve the error message and show it in a custom message bar outside of Flexmonster:
You are right; currently, the whole process is handled within Flexmonster. Our team will need some time to research convenient ways to handle such cases, and we will share the results with the ETA 22nd of February.

In the meantime, feel free to reach out to us if any questions arise.
 
Kind regards,
Vera

Public
Vera Didenko Vera Didenko Flexmonster February 7, 2022

Hello,
 
Hope all is well!
 
We are happy to inform you that our team improved how Flexmonster handles errors when connecting to Elasticsearch.
 
This is available in the 2.9.18 (latest) minor release version of Flexmonster.
You are welcome to update the component.
 
As mentioned in our previous response, our team will also check for convenient ways to retrieve the error message. We will provide an update on this point with the ETA 22nd of February.
 
We will keep in touch!
 
Kind regards,
Vera

Public
Vera Didenko Vera Didenko Flexmonster February 22, 2022

Hello,
 
We are happy to inform you that our team has added a way to handle errors outside Flexmonster.
 
Now, events olapstructureerror / queryerror / dataerror receive an additional argument with error details.
This way, you can get the error message to display it in your own message bar. Here is a JSFiddle for illustration: https://jsfiddle.net/flexmonster/pbvz5f7c/.
 
This is available in the latest (2.9.19) version of Flexmonster.
You are welcome to update the component.
 
Please let us know if the update works well for you.
We are looking forward to your feedback.
 
Kind regards,
Vera

Public
Vera Didenko Vera Didenko Flexmonster March 1, 2022

Hello,
Hope all is well!
 
Our team is wondering if you had a chance to check out the recent update.
Did it work to get the error details in the olapstructureerror / queryerror / dataerror events and show them in your own message bar?
 
Please let us know if everything worked.
Looking forward to your reply.
 
Kind regards,
Vera

Public
Vera Didenko Vera Didenko Flexmonster March 8, 2022

Hello,
 
Hope you are having a wonderful week!
 
We are wondering if the update helped you.
Could you please let us know if it worked to get the error details to display them in your message bar?
 
We are waiting for your confirmation.
 
Kind regards,
Vera

Please login or Register to Submit Answer