---
url: /flow/guide/scripting-reference/functions/exceptions/exceptiontostring.md
---

# ExceptionToString

## Declaration

Function ExceptionToString(See [ExceptionType](/flow/guide/scripting-reference/functions/exceptions/exceptiontype), [ExceptionParam](/flow/guide/scripting-reference/functions/exceptions/exceptionparam)): string;

### Example

```pascal
procedure OnMapEvent(var Value:Variant);
begin
try
Value := 1/0;
except
LogError('Exception occurred: ' + ExceptionToString(ExceptionType, ExceptionParam));
end;
end;
```

## Description

Returns the exception formatted as a String error message. You should log the results of this call to the action Log or Windows Event Viewer (Refer [Logging](/flow/guide/scripting-reference/functions/logging/) functions)
