Delphi / Object Pascal · Database exception

EDatabaseError Exception

What does EDatabaseError Exception mean in Delphi / Object Pascal?

The general-purpose exception class for database errors raised by VCL/FMX dataset components (TDataSet descendants) when something goes wrong at the data-access level - a failed field lookup, a dataset state violation, or a data-access component detecting an invalid operation. Nearly every other Delphi database exception class (EDBEngineError, EIBError, EFDException, EUpdateError) descends from it directly or indirectly.

EDatabaseError ExceptionDelphi (VCL) · Delphi (FireMonkey)

Condition

The general-purpose exception class for database errors raised by VCL/FMX dataset components (TDataSet descendants) when something goes wrong at the data-access level - a failed field lookup, a dataset state violation, or a data-access component detecting an invalid operation. Nearly every other Delphi database exception class (EDBEngineError, EIBError, EFDException, EUpdateError) descends from it directly or indirectly.

Fix

Catch EDatabaseError as a safety net around dataset operations when the specific backend doesn't matter, but prefer catching a more specific descendant first when you need backend-specific handling, since a broad EDatabaseError handler also catches those.

Related database exception