When working with the Borland Database Engine (BDE) you've probably seen exceptions raised by the BDE.
Examples:
'Key violation'
'Table does not exist'
The raised exception EDBEngineError is a subclass of the Exception class, one with additional functionality not provided in the base class.
Specifically, EDBEngineError errors are lists of other error messages. You can enumerate the error messages and display them as additional information when problems occur, as shown in the following example.
program BDE_Error_Demo;
var
sMsg: String;
i : integer;
// Uses the EDBEngineError's ErrorCount() method to enumerate all errors
// on BDE's stack of messages. They are collected in a string and displayed.
begin
try
// something prone to errors..
except
on e : EDBEngineError do
begin
sMsg := 'BDE Error Details:' + #13#10#13#10;
for i := 0 to ErrorCount - 1 do
begin
sMsg := strErrors + '(' + IntToStr(Errors[i].ErrorCode) +
') ' + Errors[i].Message + #13#10
end; { for i }
Application.MessageBox(PChar(sMsg), 'Error', MB_ICONHAND + MB_OK)
end;
end; { try }
end.