Understanding how queries work in Retool is essential. In Retool, every query has two properties: .data
and .error
. Typically, when executing a JavaScript query, the returned value is assigned to .data
. However, you might expect that a thrown error would be captured and assigned to .error
. Surprisingly, running the following JavaScript query results in query.error === undefined
:
throw new Error("error message");
Even trying an alternative approach, such as the one shown below, still leaves .error
undefined:
throw "error message";
This raises the question: Is there a way to explicitly set the value of .error
in a JavaScript query?
I would appreciate any insights or suggestions on how to handle this scenario effectively. Thank you!