# Error debugging

Debugging is a crucial aspect of the experimental process. Catching and correcting errors before they impact participants is key to ensuring reliable results. [Cognition](https://www.cognition.run/) offers integrated tools to facilitate efficient debugging. Here's how you can harness these tools:

#### **1. Preemptive Error Detection**

Cognition's interface is designed to help users identify issues before their experiment goes live:

* Detecting errors during the design phase can save significant time and prevent faulty data collection.

#### **2. Precision in Code Editor**

One of the primary tools in your debugging arsenal is Cognition's code editor:

* It precisely pinpoints any exceptions in your code, highlighting the exact line and column where the exception has been thrown. This granular feedback assists in quickly locating and rectifying the problem.

#### **3. Real-time Exception Collection**

Even with meticulous pre-testing, there's a possibility that uncaught exceptions might arise during the actual execution of the experiment:

* Should this happen, Cognition proactively collects these unhandled exceptions from the participant's browser.
* These exceptions are then relayed to your dashboard, offering you a direct insight into any issues that occurred during a run.

#### **4. Marking Faulty Runs**

To ensure data integrity and assist in data analysis:

* Any run where an exception was thrown will be specifically marked as "With errors" on your dashboard. This labeling helps in easily identifying and potentially discarding problematic data sets.

#### **5. JsPsych Library & Debugging**

It's worth noting that while Cognition is tightly integrated with the JsPsych library, it doesn't serve as its official troubleshooting resource:

* If you encounter JsPsych-specific issues or need specialized guidance related to the library, the best resource is the official JsPsych website. You can find comprehensive documentation and support at [JsPsych's official site](https://jspsych.org/).

In conclusion, Cognition prioritizes a seamless debugging experience, arming researchers with the tools they need to ensure their experiments run smoothly. By offering detailed error feedback and real-time exception tracking, Cognition strives to make the experimental process as robust and efficient as possible.
