---
title: mapError
summary: Get information about an error as a ready-to-print array. This includes the error name, message, and a call stack.
url: https://www.fastly.com/documentation/reference/compute/sdks/javascript/js-compute/experimental/fn.mapError/
---

**Kind:** Function  
**Module:** [experimental](https://www.fastly.com/documentation/reference/compute/sdks/javascript/js-compute/experimental/)  
**Package:** @fastly/js-compute 4.0.1  
**Since:** 3.37.0  
**Source:** https://github.com/fastly/js-compute-runtime/blob/70cf30af4e657879b2d1e7eafab880e39e3a3f7d/types/experimental.d.ts#L102

```javascript
mapError(error: Error | string): Array<Error | string>
```

Get information about an error as a ready-to-print array.
This includes the error name, message, and a call stack.

If `--enable-stack-traces` is specified during the build, the call stack
will be mapped using source maps. If `--enable-stack-traces` is specified
and `--exclude-sources` is not, this will also include a code dump of
neighboring lines of user code.

**Parameters**

- `error`: `Error | string`

  The error to retrieve information about. If a string is
    provided, it is first converted to an `Error`.

**Returns**

`Array<Error | string>`
