Exception Handling

The .NET Access Provider uses, of course, .NET native way of handling exceptions that may occur in applications. The exceptions thrown are (almost) always of FndException class or a subclass thereof. To each exception thrown there is a more or less descriptive message attached.

Exceptions are, for instance, thrown when trying to access a server that is down. 

Exception Classes

All exceptions in .NET are thrown as a System.Exception of a subclass thereof. All exceptions thrown by the .NET Access Provider should be refined to an Ifs.Fnd.FndException or a subclass thereof. The class hierarchy looks as shown below:

System.Exception - Base class for all .NET exceptions
    Ifs.Fnd.FndException - Base class for all IFS Exceptions
        Ifs.Fnd.FndApplicationException - An expected exception throwed by business logic
        Ifs.Fnd.FndSecurityException - An expected exception throwed by security related errors
        Ifs.Fnd.FndSystemException - An unexpected exception 
        Ifs.Fnd.FndValidationException - An expected exception caused by data validation
 

Syntax

The FndConnection class has a property named CatchExceptions that should be set to false when you want to write your own exception hadling. It is strongly recommended to do so.

The FndException has a Show method that can be called in the catch block for interactive applications.

Interactive applications:

try
{
    // Do stuff
}
catch(FndException err)
{
    err.Show();
}

Non interactive applications:

try
{
    // Do stuff
}
catch(FndException err)
{
    string s = err.Message + "\n\n" + err.StackTrace;
    // Write s to log etc...
}