Hello,
We are getting an issue where, when registering event listeners such as dataerror, queryerror etc, even though they get fired properly, the error passed is undefined. Errors are getting displayed properly in the Flexmonster error popup, however.
Do you have suggestions on how to debug/proceed on this issue?
Hello, Will!
Thank you for reaching out to us.
Our team hasn't managed to reproduce the described behavior on our side. Could you please modify the following JsFiddle to make the case reproducible? With this information, we'll be able to advise you further.
Looking forward to hearing from you.
Kind regards,
Solomiia
Hello Solomiia,
It seems that we get this error when using the Custom Data Source API and the backend returns a 400 error with a response containing only the error string. What is the expected format/status code when returning an error?
Best,
Will
Hello, Will!
Thank you for the provided details.
We would like to begin by explaining the default error handling flow in Flexmonster:
1) The server returns the 400 error with or without an error message. E.g. on Node.js:
let message = "custom error message";
res.status(400).json(message); //or res.status(400).send()
2) The client receives and processes the error, adding the error message from localization based on the error code
3) An error popup with a corresponding message is shown
4) The error with the error message is returned to queryerror event handler:
pivot.on("queryerror", function (e) {
console.log("on queryerror", e)
})
We have tested the following flow on our side with custom data source API and ensured that the error message is returned to the queryerror
event handler, even if we send only the error status from the server.
Hope it helps.
If you need our further assistance, we kindly ask you to provide a minimal reproducible sample of the described behavior with an undefined error in queryerror
handler, so we can test it on our side.
Kind regards,
Solomiia