Tivoli Connection Guide and Reference


Generating a Tivoli Event from a Smalltalk Exception

The TivExceptionsApp includes three classes that assist in generating a Tivoli Application System Error event when a Smalltalk exception occurs.

  1. TivExceptionalEvent is a subclass of ExceptionalEvent that provides an interface to the TECEIF.DLL and generates an Application System Error event when an instance is signalled.
  2. TivExceptionalEventRoot is a subclass of Object that defines a TivExceptionalEvent instance that is the root, or parent, of all TivExceptionalEvent instances.
  3. TivSampleExceptionsCheckingAccount is a sample class that illustrates how to define and signal TivExceptionalEvents.

Defining a TivExceptionalEvent

The TivSampleExceptionsCheckingAccount class methods define two exceptions that are represented as class variables. One of the exceptions, TivExCheckingAccountOverdrawn, is defined by

      anExceptionalEvent := TivExceptionalEventRoot root newChild.
      anExceptionalEvent description: 'Checking Account Overdrawn'.
      anExceptionalEvent resumable: false.
      anExceptionalEvent defaultHandler:
         [:sig | System errorMessage sig description.
                 sig exitWith: 'done'].
      self TivExCheckingAccountOverdrawn: anExceptionalEvent.

Signalling a TivExceptionalEvent

The following TivSampleExceptionsCheckingAccount instance method illustrates how the TivExCheckingAccountOverdrawn exception is signalled:

      withdraw: anAmount
         self balance >= anAmount
            ifTrue:  [self balance: self balance - anAmount]
            ifFalse: [self class TivExCheckingAccountOverdrawn
                         signalWithArguments:
                            (OrderedCollection
                                with:self
                                with:(Association key:'balance' 
                                                 value:self balance)
                                with:(Association key:'amount'
                                                 value:self amount))].

Using the Sample application

The sample will generate a TivExCheckingAccountOverdrawn exception when the following is executed:

       TivSampleExceptionsCheckingAccount new withdraw: 10000.

The sample will generate a TivExCheckingAccountInsuredAmountExceeded exception when the following is executed:

       TivSampleExceptionsCheckingAccount new deposit: 500000.
Note:The Tivoli Application System Error events that are generated by these exceptions are logged to the file, TECEIF.LOG.


[ Top of Page | Previous Page | Next Page | Table of Contents ]