how to handle error from Flexmonster

Answered
Patrick LAMOTTE asked on October 8, 2018

Hi,
When we send too many datas to Flexmonster, we get an error, see attached.
I have 2 questions, how can we catch this error and show to the user a friendly message ?
and do you know how many datas we are able to send to Flexmonster ?
Thanks
Patrick

Attachments:
flexmonster-error.png

9 answers

Public
Dmytro Zvazhii Dmytro Zvazhii Flexmonster October 8, 2018

Hello Patrick,
Thank you for writing. The error from the screenshot is 504 Gate timeout error.
Such type of error says that the server was not able to return the response in time. Usually, it happens when the server receives too many requests and the server is not able to handle them all. After that, the server sends a webpage with 504 error as a response. You can see it in the details of the error. Such type of errors should be handled on the server side. We recommend you to configure the server response and respond with a friendly message to a user. Also please note, that Flexmonster does not have any limitations on the number of data.
Let us know in case of any other questions.
Regards,
Dmytro

Public
Patrick LAMOTTE October 8, 2018

Hi Dmytro,
Thanks for the answer, 2 things :
when you write "Usually, it happens when the server receives too many requests and the server is not able to handle them all" which server do you mean, yours or ours ?

you said Flexmonster has no limitation, ok but do you have a document about the best practices to send datas to Flexmonster
thanks
Patrick

Public
Dmytro Zvazhii Dmytro Zvazhii Flexmonster October 10, 2018

Hello Patrick,
Thank you for your feedback. Please note that Flexmonster is a client-side application which runs on client's browser.
Therefore, it is only about your server from which Flexmonster loads the data.
As for the best practices for loading the data, everything depends on your data source.
In case you are using SQL database, we recommend trying our Flexmonster Data Compressor to get a better performance: https://www.flexmonster.com/doc/connecting-to-relational-database/ .
Please let us know if the information above was helpful for you.
Regards,
Dmytro

Public
Patrick LAMOTTE October 19, 2018

Hi Dmytro,
So, we tried something : the 504 error comes from a timeout of the infrastructure between our webapp and the browser (the load balancer or reverse proxy). Thus we have no way to configure the server message linked to this 504. What we've done is listening to the dataerror event and customized the alert like this
flexmonster.on('dataerror', function () {
flexmonster.alert({
title: I18n.t('js.too_large_request'),
message: I18n.t('js.try_decrease_interval'),
type: "info"
});
});
Do you know if there is a way to check the reason behind the dataerror ? We'd like to trigger our custom alert only on a 504 responde code.
Thanks
Patrick

Public
Tanya Gryshko Tanya Gryshko Flexmonster October 19, 2018

Hello, Patrick,
We are glad you've customized the alert to suit your needs.
As about a way to check the reason behind the dataerror, we can add the following improvement: the error message from the response can be passed to dataerror event. You can see the content of such message on the screenshot you provided us with at the beginning of this thread (the error message is shown after 'Details:'). The access to this error message inside dataerror would allow further customizing of the alert. Would such improvement work for you?
Please keep in mind that our component would have access to such messages only in case they are returned from your server-side (as on the screenshot).
Regards,
Tanya

Public
Patrick LAMOTTE October 22, 2018

Hi Tanya,
Thanks for proposition, yes it would be a nice improvement for us.
Let me know when it will be available.
Best regards
Patrick

Public
Dmytro Zvazhii Dmytro Zvazhii Flexmonster October 22, 2018

Hello Patrick,
Thank you for your feedback. Our dev team will add the update to the nearest minor release ETA Nov05.
We will keep you updated.
Regards,
Dmytro

Public
Patrick LAMOTTE October 22, 2018

great, thanks

Public
Dmytro Zvazhii Dmytro Zvazhii Flexmonster November 6, 2018

Hello Patrick,
We are glad to inform you that the latest version of the component is already available on our website.
You are welcome to try the update for the dataerror event.
Also, here is a code example:

flexmonster.on("dataerror", function (e) {
flexmonster.alert({title: e.error, type: "info"});
});

Let us know if everything works fine for you.
Regards,
Dmytro

Please login or Register to Submit Answer