FTExceptionClass Module

An FTException object gives a way to pass generic information about an exceptional situation.

An FTException object gives a way to pass generic information about an exceptional situation. Methods for dealing with exceptions are defined in the SharedExceptionManagerModule module.

An FTException object wraps:

  • A severity indicator
  • A name for the exception
  • An optional dictionary that contains whatever information is deemed necessary.

It is expected that classes will define exceptions that use instances of the FTException Class.

Defined constants:

  • FT_ERROR_NONE = 0
  • FT_ERROR_WARNING = 1
  • FT_ERROR_FATAL = 2

Initialization

        CALL e  %  initFTException(severity,exceptionName,infoDictionary)

Plus the convenience initializers, which automatically create a FTValueDictionary with a single key called "message":

    CALL e % initWarningException(msg = "message")
    CALL e % initFatalException(msg = "message")

Plus an assertion exception

    CALL e % initAssertionFailureException(msg,expectedValueObject,observedValueObject,level)

Destruction

    CALL releaseFTException(e) [pointers]

Setting the infoDictionary

    CALL e  %  setInfoDictionary(infoDictionary)

Getting the infoDictionary

    dict => e % infoDictionary

Getting the name of the exception

    name = e % exceptionName()

Getting the severity level of the exception

    level = e % severity()

Severity levels are FT_ERROR_WARNING or FT_ERROR_FATAL

Printing the exception

    CALL e % printDescription()

Uses

  • module~~ftexceptionclass~~UsesGraph module~ftexceptionclass FTExceptionClass module~ftdictionaryclass FTDictionaryClass module~ftexceptionclass->module~ftdictionaryclass module~ftlinkedlistiteratorclass FTLinkedListIteratorClass module~ftexceptionclass->module~ftlinkedlistiteratorclass module~ftstackclass FTStackClass module~ftexceptionclass->module~ftstackclass module~ftvaluedictionaryclass FTValueDictionaryClass module~ftexceptionclass->module~ftvaluedictionaryclass module~ftdictionaryclass->module~ftlinkedlistiteratorclass module~ftkeyobjectpairclass FTKeyObjectPairClass module~ftdictionaryclass->module~ftkeyobjectpairclass module~ftlinkedlistclass FTLinkedListClass module~ftdictionaryclass->module~ftlinkedlistclass module~ftmutableobjectarrayclass FTMutableObjectArrayClass module~ftdictionaryclass->module~ftmutableobjectarrayclass module~hashmodule HashModule module~ftdictionaryclass->module~hashmodule module~ftlinkedlistiteratorclass->module~ftlinkedlistclass module~ftstackclass->module~ftlinkedlistclass module~ftvaluedictionaryclass->module~ftdictionaryclass iso_fortran_env iso_fortran_env module~ftvaluedictionaryclass->iso_fortran_env module~ftvalueclass FTValueClass module~ftvaluedictionaryclass->module~ftvalueclass module~ftobjectclass FTObjectClass module~ftkeyobjectpairclass->module~ftobjectclass module~ftlinkedlistclass->module~ftmutableobjectarrayclass module~ftlinkedlistrecordclass FTLinkedListRecordClass module~ftlinkedlistclass->module~ftlinkedlistrecordclass module~ftmutableobjectarrayclass->module~ftobjectclass module~ftvalueclass->iso_fortran_env ieee_arithmetic ieee_arithmetic module~ftvalueclass->ieee_arithmetic module~ftvalueclass->module~ftobjectclass module~ftolconstants FTOLConstants module~ftvalueclass->module~ftolconstants module~ftlinkedlistrecordclass->module~ftobjectclass

Used by

  • module~~ftexceptionclass~~UsedByGraph module~ftexceptionclass FTExceptionClass module~ftobjectlibrary FTObjectLibrary module~ftobjectlibrary->module~ftexceptionclass module~sharedexceptionmanagermodule SharedExceptionManagerModule module~sharedexceptionmanagermodule->module~ftexceptionclass

Variables

Type Visibility Attributes Name Initial
integer, public, parameter :: FT_ERROR_NONE = 0
integer, public, parameter :: FT_ERROR_WARNING = 1
integer, public, parameter :: FT_ERROR_FATAL = 2
integer, public, parameter :: ERROR_MSG_STRING_LENGTH = 132
character(len=21), public, parameter :: FTFatalErrorException = "FTFatalErrorException"
character(len=23), public, parameter :: FTWarningErrorException = "FTWarningErrorException"
character(len=27), public, parameter :: FTAssertionFailureException = "FTAssertionFailureException"

Interfaces

public interface cast

  • public subroutine castToException(obj, cast)

    Cast the base class FTObject to the FTException class

    Arguments

    Type IntentOptional Attributes Name
    class(FTObject), POINTER :: obj
    class(FTException), POINTER :: cast

Derived Types

type, public, extends(FTObject) ::  FTException

Finalizations Procedures

final :: destructException

Type-Bound Procedures

procedure, public :: init => initFTObject
procedure, public :: description => FTObjectDescription
procedure, public, non_overridable :: copy => copyFTObject
procedure, public, non_overridable :: retain => retainFTObject
procedure, public, non_overridable :: isUnreferenced
procedure, public, non_overridable :: refCount
procedure, public :: initFTException
procedure, public :: initWarningException
procedure, public :: initFatalException
procedure, public :: initAssertionFailureException
procedure, public :: setInfoDictionary
procedure, public :: infoDictionary
procedure, public :: exceptionName
procedure, public :: severity
procedure, public :: printDescription => printFTExceptionDescription
procedure, public :: className => exceptionClassName

Functions

public function infoDictionary(self)

Returns the exception's infoDictionary. Does not transfer ownership/reference count is unchanged.

Arguments

Type IntentOptional Attributes Name
class(FTException) :: self

Return Value class(FTDictionary), POINTER

public function exceptionName(self)

Returns the string representing the name set for the exception.

Arguments

Type IntentOptional Attributes Name
class(FTException) :: self

Return Value character(len=ERROR_MSG_STRING_LENGTH)

public function severity(self)

Returns the severity level of the exception.

Arguments

Type IntentOptional Attributes Name
class(FTException) :: self

Return Value integer

public function exceptionFromObject(obj) result(cast)

Arguments

Type IntentOptional Attributes Name
class(FTObject), POINTER :: obj

Return Value class(FTException), POINTER

public function exceptionClassName(self) result(s)

Class name returns a string with the name of the type of the object

Read more…

Arguments

Type IntentOptional Attributes Name
class(FTException) :: self

Return Value character(len=CLASS_NAME_CHARACTER_LENGTH)


Subroutines

public subroutine initWarningException(self, msg)

A convenience initializer for a warning error that includes the key "message" in the infoDictionary. Use this initializer as an example of how to write one's own exception.

Arguments

Type IntentOptional Attributes Name
class(FTException) :: self
character(len=*) :: msg

public subroutine initFatalException(self, msg)

A convenience initializer for a fatal error that includes the key "message" in the infoDictionary.Use this initializer as an example of how to write one's own exception.

Arguments

Type IntentOptional Attributes Name
class(FTException) :: self
character(len=*) :: msg

public subroutine initFTException(self, severity, exceptionName, infoDictionary)

The main initializer for the class

Arguments

Type IntentOptional Attributes Name
class(FTException) :: self
integer :: severity
character(len=*) :: exceptionName
class(FTDictionary), optional, POINTER :: infoDictionary

public subroutine initAssertionFailureException(self, msg, expectedValueObject, ObservedValueObject, level)

A convenience initializer for an assertion error that includes the keys:

Read more…

Arguments

Type IntentOptional Attributes Name
class(FTException) :: self
character(len=*) :: msg
class(FTValue), POINTER :: expectedValueObject
class(FTValue), POINTER :: ObservedValueObject
integer :: level

public subroutine releaseFTException(self)

Arguments

Type IntentOptional Attributes Name
type(FTException), POINTER :: self

public subroutine destructException(self)

The destructor for the class. Do not call this directly. Call the release() procedure instead

Arguments

Type IntentOptional Attributes Name
type(FTException) :: self

public subroutine setInfoDictionary(self, dict)

Sets and retains the exception infoDictionary

Arguments

Type IntentOptional Attributes Name
class(FTException) :: self
class(FTDictionary), POINTER :: dict

public subroutine releaseMemberDictionary(self)

Arguments

Type IntentOptional Attributes Name
class(FTException) :: self

public subroutine printFTExceptionDescription(self, iUnit)

A basic printing of the exception and the info held in the infoDictionary.

Arguments

Type IntentOptional Attributes Name
class(FTException) :: self
integer :: iUnit

public subroutine castToException(obj, cast)

Cast the base class FTObject to the FTException class

Arguments

Type IntentOptional Attributes Name
class(FTObject), POINTER :: obj
class(FTException), POINTER :: cast