---
title: scriptErrorString
framework: foundation
role: symbol
role_heading: Instance Property
path: foundation/nsscriptcommand/scripterrorstring
---

# scriptErrorString

Sets a script error string that is associated with execution of the command.

## Declaration

```swift
var scriptErrorString: String? { get set }
```

## Parameters

- `errorString`: A string that describes an error.

## Discussion

Discussion If you override performDefaultImplementation() and an error occurs, you should call this method to supply a string that provides a useful explanation. In fact, any script handler should call this method when an error occurs. Calling this method alone does not cause an error message to be displayed—you must also call scriptErrorNumber to supply an error number.

## See Also

### Handling script execution errors

- [scriptErrorExpectedTypeDescriptor](foundation/nsscriptcommand/scripterrorexpectedtypedescriptor.md)
- [scriptErrorNumber](foundation/nsscriptcommand/scripterrornumber.md)
- [scriptErrorOffendingObjectDescriptor](foundation/nsscriptcommand/scripterroroffendingobjectdescriptor.md)
