# 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.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.cognition.run/error-debugging.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
