Last active
April 1, 2016 17:57
-
-
Save bigfox/0ba6a95c52a053d13d79 to your computer and use it in GitHub Desktop.
Lotusscript - Error handling
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
' FUNCTION | |
Function TestFunction(param as String) As String | |
On Error GoTo ErrorThrower | |
' CUSTOM CODE | |
Exit Function | |
ErrorThrower: | |
Error Err, Error & Chr(13) & "Function: " & GetThreadInfo(1) & ", Line: " & Erl | |
End Function | |
' SUB | |
Sub TestSub | |
On Error GoTo ErrorThrower | |
' CUSTOM CODE | |
Exit Sub | |
ErrorThrower: | |
Error Err, Error & Chr(13) & "Sub: " & GetThreadInfo(1) & ", Line: " & Erl | |
End Sub | |
' CLASS | |
Class Test | |
Sub TestSub | |
On Error GoTo ErrorThrower | |
' CUSTOM CODE | |
Exit Sub | |
ErrorThrower: | |
Error Err, Error & Chr(13) & "Class: " & TypeName(Me) & ", Module: " & GetThreadInfo(1) & ", Line: " & Erl | |
End Sub | |
Function TestFunction() As String | |
On Error GoTo ErrorThrower | |
' CUSTOM CODE | |
Exit Function | |
ErrorThrower: | |
Error Err, Error & Chr(13) & "Class: " & TypeName(Me) & ", Module: " & GetThreadInfo(1) & ", Line: " & Erl | |
End Function | |
End Class | |
' INITIALIZE | |
Sub Initialize | |
On Error Goto ErrorHandle | |
' CUSTOM CODE | |
Terminate: | |
Exit Sub | |
ErrorHandle: | |
Dim e As String | |
e = "Error "& Err & Chr(13) & Error & Chr(13) & "Sub: " & GetThreadInfo(1) & ", Line: " & Erl | |
' CUSTOM OUTPUT | |
Resume Terminate | |
End Sub |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment