---
url: >-
  /statelake/scripting-reference/functions-and-procedures/logging-functions/messageerror.md
---

# MessageError

**MessageError** displays a error message to the user. How this message is displayed depends on what application is executing the script.

If executed under **Statelake** this message will show to screen - the user needs to click **OK** to the message to continue processing.

If executed under **Statelake Service** the message will be written to the Windows Event Viewer.

**Declaration**: Procedure MessageError( AMessage)

A simple script to try.

```pascal
procedure ScriptEvent (var Value : variant);
begin
  MessageError('This script has encountered an error - select OK to continue.');
end;
```

This script produces the following.
