Salesforce

.NET Exceptions (Magic xpa 3.x)

« Go Back

Information

 
Created ByKnowledge Migration User
Approval Process StatusPublished
Objective
Description

.NET Exceptions (Magic xpa 3.x)

When you work with .NET from within Magic xpa and your program causes a .NET runtime error, it is important that you catch the .NET exception from your Magic xpa program and supply the end user with the basic information regarding the source of the problem.

If there is an illegal operation in .NET, an exception will occur. However, the end user will not see the exception unless you handle it.

Magic xpa enables you to handle .NET exceptions with the help of two internal functions:

  • The DNExceptionOccurred() function informs you that an error occurred during the last .NET operation.

  • The DNException() function returns a reference to the last error that occurred by a .NET operation.

If you have programmed with Magic xpa and Java, then this concept will be familiar to you.

Programming in .NET, you create a Try / Catch block. Look at this simplified example in which the code divides by zero:

Dim num as Integer

Dim zero as Integer

Try

Zero = 0

num = num / zero

Catch

MessageBox.Show (“Zero divide!”)

End Try


Magic xpa works slightly differently. Magic xpa encloses every .NET operation in a Try / Catch block. It is your responsibility to handle any exception that may occur. Since the Magic xpa .NET error functions refer to the last error that occurred, it is important to check for exceptions after every relevant operation.

Reference
Attachment 
Attachment