---
title: "setErrorHandler"
canonical: "https://help.vicon.com/space/ShogunPost121/1253736908/setErrorHandler"
format: markdown
---
# Description

Sets a script to run when a script error has occurred.

Shogun Post enables you to specify a script that is automatically run if another script that it is executing fails. This may be useful when setting up a farm of Shogun Post machines which automatically process files. For example, the error handler script may call the system command to run a Python script to email interested parties.

## Functional area

System

# Command syntax

## Syntax

> Macro (scroll-tablelayout)

|  |
| --- |
| `setErrorHandler ["script"]` |

### Arguments

> Macro (scroll-tablelayout)

| Name | Type | Required | Comments |
| --- | --- | --- | --- |
| `script` | string | no | Name of script the to execute. Do not specify this argument, or pass an empty string, if you wish to clear the error handler. |

### Flags

None

## Return value

void

> Macro (scroll-pagebreak)

## Examples

```plaintext
// Set our custom error handler
setErrorHandler "MyErrorHandlerScript";
 
// Clear it
setErrorHandler ""; 
// Could also have called setErrorHandler
```