VisualAge provides a default error routine that puts up a debugger window whenever an error is encountered. You can override this default temporarily or permanently by providing your own response to the error.
The following examples illustrate how to do the following:
Note: | To ensure that database processing completes, return an error object or some other appropriate object. Do not return directly from the error block. |
This sample code temporarily causes an error to print in the Transcript window instead of in a message box.
Before you can use this sample code, you need to define a connection specification and establish a database connection.
To use this sample code, follow these steps:
"Temporarily overrides default error routine" | connection err | connection := AbtDbmSystem activeDatabaseConnection. connection openTableNamed: 'NOTABLE' ifError: [:error | Transcript cr; show: (error errorText printString). err := error]. ^err.
If you want to override the error routine permanently for all database messages displayed by VisualAge, send the errorBlock: method to the current active connection.
This example assumes that you have an active connection.
To use this sample code, evaluate it using the Inspect command.
"Permanently overrides error routine" AbtDbmSystem activeDatabaseMgr errorBlock: [:error | Transcript show: (error errorText printString).].
To reset the error routine to the default, supply a value of NIL.
This example assumes that you have an active connection.
To use this sample code, evaluate it using the Execute command.
"Resets error routine to default" AbtDbmSystem activeDatabaseMgr errorBlock: nil.