---
schema_version: "1"
id: ac27d1b164eee364b69b672cd1ec4faa27d18f0ca41265c3bfe3a3fec0cae5ec
title: removeErrorHandler()
collection: developer
version: current
locale: en-us
portal_url: https://docs.salesforce.com/developer/current/en-us/platform/aura-platform/guides/aura/container/container-npm-removemessageerrorhandler.md
canonical_url: https://developer.salesforce.com/docs/platform/aura-platform/guide/container-npm-removemessageerrorhandler.html
source_site: developer.salesforce.com
content_type: documentation
content_hash: 0a7e0bd13a127fc6fc062fdd75a9ef841ec2e740c5414970dda5f0cdcfc3db95
products:
  - Lightning Aura Components Developer Guide
  - Platform Developer Content
---

# removeErrorHandler()

Unmounts the error handling function.

When using React, it’s necessary to unmount functions to remove them from the DOM and perform necessary cleanup.

## Sample

Used within a JavaScript app uploaded as a static resource and referenced by `lightning:container`, this example unmounts a message error handling function. In a React app, functions must be mounted to be part of the document-object model and rendered in the output.

```javascript
componentWillUnmount() {
  LCC.removeErrorHandler(this.onMessageError);
}
```

## Arguments

| Name                                   | Type     | Description                                                                      |
| -------------------------------------- | -------- | -------------------------------------------------------------------------------- |
| `handler: (errorMsg: string) => void)` | function | The function that handles error messages encountered in the messaging framework. |

## Response

None.
