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

# LogError

When activated, **LogError** creates an entry in the action **Log** of the type **User Error**, as illustrated in this **Log** snippet below.

Further code in this script will execute but the mapping will stop after this event, and a **LogError** will result in a **PINK log** with a failed status.

By using **LogError** you are indicating to the user that an error has occurred that cannot be recovered from automatically, and therefore the user needs to step in.

The message that is logged should be as precise as possible and provide enough information for the user to fix the problem and re-run the action.

**Declaration**: procedure LogError(aMesg : string);

A simple example follows.

```pascal
procedure OnMapEvent(var Value:Variant);
begin
 if MyData.EOF then
    LogError('You are at the end of records in MyData recordset.');
end;
```

Please also refer to [Exception Functions](/statelake/scripting-reference/functions-and-procedures/exception-functions/) and [Try....Except](/statelake/scripting-reference/statements/try....except) for additional information regards error logging.
