# FAQ

## Can I use fetch in a custom code step?

No, because the custom code environment is a V8 environment, fetch is not available. However, MESA.request is our replacement for it. You can check out the [MESA SDK](https://docs.getmesa.com/tools/custom-code/sdk) for more information on available functions in the custom code step.

## How do you throw an error from within a custom code step?

You can do that by using:

```
throw new Error("your error description")
```

## How do I get advanced details related to my automation?

To check if an automation was triggered by a "test" (triggered by a [manual run](https://docs.getmesa.com/workflow-builder/testing) in a workflow) or by an actual "live" run (usually triggered with webhooks) you can check for `context.task.is_test`

* Mesa will set `context.task.is_test` to `true` if the automation was a manual run
* Mesa will set `context.task.is_test` to `false` if the automation was triggered naturally

You can also explore what `context.task` has by logging it in your code: `Mesa.log.info('context.task', context.task);`

* For example, you can access the workflow title as: `context.task.automation.automation_name`


---

# 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.getmesa.com/tools/custom-code/faq.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.
