<!--
{
  "availability" : [
    "macCatalyst: 13.0.0 -",
    "macOS: 10.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "Foundation",
  "identifier" : "/documentation/Foundation/NSScriptCommand/scriptErrorString",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Property",
  "symbol" : {
    "kind" : "Instance Property",
    "modules" : [
      "Foundation"
    ],
    "preciseIdentifier" : "c:objc(cs)NSScriptCommand(py)scriptErrorString"
  },
  "title" : "scriptErrorString"
}
-->

# scriptErrorString

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

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

## Parameters

`errorString`

A string that describes an error.

## Discussion

If you override [`performDefaultImplementation()`](/documentation/Foundation/NSScriptCommand/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`](/documentation/Foundation/NSScriptCommand/scriptErrorNumber) to supply an error number.

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)