> ## Documentation Index
> Fetch the complete documentation index at: https://loadwise.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# throw-non-error

> A string, number or object literal is thrown instead of an Error, so there is no stack trace.

## What it flags

`throw` of a string, template, number, object literal, array, boolean, `null` or global `undefined` gives no stack trace and fails `instanceof Error` checks in callers. Throw an `Error` or a subclass. Thrown variables and call results are not judged.

A parser can use a private sentinel when the nearest catch consumes the thrown value and returns a fallback. A catch that passes the value on or rethrows it keeps the diagnostic.

## How to review or fix

Select a plain string literal finding individually to preview wrapping it in a built-in `Error`. The preview requires the compiler to resolve the built-in constructor and the project sources to have no detected writes to that binding. Before applying the edit, Loadwise checks the project file inventory and the source text used to build the preview. The editor checks open buffers as well as saved files and limits how many files and bytes it reads for one edit. Catch handlers then receive an object. Review any equality or type checks that depend on the original string.

## Configuration

Set the rule to `"off"` in `loadwise.config.json` to drop its findings:

```json theme={null}
{
  "rules": { "throw-non-error": "off" }
}
```


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.