mirror of
https://github.com/ToolJet/ToolJet
synced 2026-04-21 21:47:17 +00:00
* [docs]revamped howto: serverside pagination * [docs]revamp howto: import ext. js libs * [docs]revamp howto:run actions from js query * [docs]revamp howto: intentionally fail js query * updated run query at specified * revamped how to: use to_py * [docs]updated how to access users location * updated howtos in v2.30
1.4 KiB
1.4 KiB
| id | title |
|---|---|
| intentionally-fail-js-query | Intentionally Throwing an Error in RunJS for Debugging |
In this step-by-step guide, we'll walk you through the process of creating a RunJS query that intentionally throws an error for debugging purposes.
Creating the Error-Throwing RunJS Query
-
Create a new RunJS query by clicking the
+ Addbutton on the query panel. -
Paste the following code into the RunJS query editor. This code utilizes the
ReferenceErrorconstructor to intentionally generate an error.throw new ReferenceError('This is a reference error.');
Adding an Event Handler for Failure
-
Now, enhance the query by adding an event handler that will display an alert when the query fails.
-
Click the "Run" button to execute the query and observe the intentional error being thrown.
Refer to the screencast below:
By following these steps, you can effectively simulate errors in your RunJS queries, aiding in the debugging process and improving the overall robustness of your code.