SharedExceptionManagerModule Module

All exceptions are posted to the SharedExceptionManagerModule.

To use exceptions,first initialize it CALL initializeFTExceptions From that point on, all exceptions will be posted there. Note that the FTTestSuiteManager class will initialize the SharedExceptionManagerModule, so there is no need to do the initialization separately if the FTTestSuiteManager class has been initialized.

The exceptions are posted to a stack. To access the exceptions they will be peeked or popped from that stack.

Initialization

    CALL initializeFTExceptions

Finalization

    CALL destructFTExceptions

Throwing an exception

     CALL throw(exception)

Getting the number of exceptions

     n = errorCount()

Catching all exceptions

     IF(catch())     THEN
        Do something with the exceptions
     END IF

Getting the named exception caught

     CLASS(FTException), POINTER :: e
     e => errorObject()

Popping the top exception

     e => popLastException()

Peeking the top exception

     e => peekLastException()

Catching an exception with a given name

     IF(catch(name))   THEN
        !Do something with the exception, e.g.
        e              => errorObject()
        d              => e % infoDictionary()
        userDictionary => valueDictionaryFromDictionary(dict = d)
        msg = userDictionary % stringValueForKey("message",FTDICT_KWD_STRING_LENGTH)
     END IF

Printing all exceptions

  call printAllExceptions


Interfaces

public interface catch

  • private function catchAll()

    Returns .TRUE. if there are any exceptions.

    Arguments

    None

    Return Value logical

  • private function catchErrorWithName(exceptionName)

    Returns .TRUE. if there is an exception with the requested name. If so, it pops the exception and saves the pointer to it so that it can be accessed with the currentError() function.

    Arguments

    Type IntentOptional Attributes Name
    character(len=*) :: exceptionName

    Return Value logical


Functions

public function errorCount()

Returns the number of exceptions that have been thrown.

Arguments

None

Return Value integer

public function errorObject()

Returns a pointer to the current exception.

Arguments

None

Return Value class(FTException), POINTER

public function popLastException()

Get the last exception posted. This is popped from the stack. The caller is responsible for releasing the object after popping

Arguments

None

Return Value class(FTException), POINTER

public function peekLastException()

Get the last exception posted. This is NOT popped from the stack. The caller does not own the object.

Arguments

None

Return Value class(FTException), POINTER


Subroutines

public subroutine initializeFTExceptions()

Called at start of execution. Will be called automatically if an exception is thrown.

Arguments

None

public subroutine destructFTExceptions()

Called at the end of execution. This procedure will announce if there are uncaught exceptions raised and print them.

Arguments

None

public subroutine throw(exceptionToThrow)

Throws the exception: exceptionToThrow

Arguments

Type IntentOptional Attributes Name
class(FTException), POINTER :: exceptionToThrow

public subroutine setCurrentError(e)

Arguments

Type IntentOptional Attributes Name
class(FTException), POINTER :: e

public subroutine printAllExceptions()

Arguments

None

public subroutine releaseCurrentError()

Arguments

None