---
url: >-
  /statelake/scripting-reference/functions-and-procedures/exception-functions/exceptionproc.md
---

# ExceptionProc

**ExceptionProc** returns an exception parameter value indicates the procedure that generated the exception.

**ExceptionProc** can also be used in conjunction with the **ExceptionToString** function to better identify the exception and its cause.

**Declaration**: function ExceptionProc: Cardinal;

Example using **LogInfo** so that the **Action** completes irrespective of the exception error. **LogWarning** or **LogError** could also be used. **LogError** will terminate the **Action** and prevent any further processing.

```pascal
procedure OnMapEvent(var Value:Variant);
var
  Int1, Int2, Int3 : integer;
begin
 //Try to divide an integer by zero - to raise an exception
 try
    Int1 := 10;
    Int2 := 0;
    Int3 := Int1 / Int2;
 //These lines will execute if no error
    LogInfo('Fabulous!');
    LogInfo('There was no problem encountered!');
 except
 //LogInfo is used so that the Action does not terminate
    LogInfo('Exception occurred in procedure # ' + IntToStr(ExceptionProc));
    LogInfo('Exception occurred: ' + ExceptionToString(ExceptionType, ExceptionParam));
    LogInfo('');
    LogInfo('ERROR: '+ExceptionToString(ExceptionType, ExceptionParam)+' which occurred in procedure # ' + IntToStr(ExceptionProc));
    LogInfo('');
 end;
  LogInfo('');
  LogInfo('The Action has completed.');
end;
```
