EAbort
Delphi Programming Language
Severity: MinorWhat Does This Error Mean?
EAbort is a special Delphi exception that is intentionally silent — it aborts an operation without showing any error dialog to the user. Unlike most exceptions, EAbort is not a sign of a bug. It is a deliberate control flow mechanism. When you raise EAbort (or call Abort), execution jumps out of the current operation cleanly, and the VCL's default exception handler ignores it completely.
Affected Models
- All Delphi versions
- RAD Studio
- VCL applications
Common Causes
- A call to the Abort procedure, which raises EAbort intentionally to cancel an operation
- Calling Abort in an OnButtonClick or OnExecute handler to cancel without showing an error message
- Third-party components or database libraries calling Abort internally when a user cancels a long operation
- An EAbort raised inside a TAction's OnExecute handler to indicate the action was cancelled
- Accidentally re-raising EAbort with a generic 'raise' or 'on E: Exception do raise' in an exception handler
How to Fix It
-
Understand what EAbort does. When the VCL's Application.HandleException sees an EAbort, it deliberately does nothing — no error dialog, no logging. This is by design. If you see a dialog, something is catching and re-raising it incorrectly.
The procedure Abort is shorthand for raise EAbort.Create('') at system level. Calling Abort is idiomatic Delphi.
-
Check your exception handlers. If you have 'on E: Exception do' blocks that re-raise or show a message for any exception, add a specific check to skip EAbort.
Example: on E: Exception do begin if not (E is EAbort) then ShowMessage(E.Message); end;
-
To cancel an operation silently, call Abort anywhere in your code. You do not need to create an EAbort object manually. Just write: Abort;
Abort is defined in the SysUtils unit, which is almost always in scope. No extra uses clause entry is needed in most projects.
-
If EAbort is being raised in a worker thread, be careful — the VCL exception handler only silences EAbort on the main thread. In threads, EAbort propagates like any other exception and can terminate the thread or crash the application.
In thread code, catch EAbort explicitly if you use Abort to cancel thread operations: on E: EAbort do exit;
-
Use EAbort in OnValidate or BeforePost database events to cancel a save without an error dialog. This is a common Delphi pattern for 'soft' cancellation.
Raise EAbort after showing your own custom validation message. That way you control the error text and the VCL does not show a second, confusing dialog.
When to Call a Professional
EAbort is never a system error — it is a feature of Delphi's exception system. If EAbort is appearing unexpectedly (showing a dialog or crashing), the problem is in how it is being caught or re-raised in your exception handlers.
Frequently Asked Questions
What is the difference between Abort and raise EAbort?
They do the same thing — Abort is simply a convenience procedure that calls raise EAbort.Create(''). Using Abort is cleaner and more idiomatic Delphi. The result is identical: an EAbort exception is raised, and the VCL exception handler silently ignores it.
Why does my application sometimes show an error dialog when I call Abort?
This happens when your code has a generic exception handler between the Abort call and the VCL handler — something like 'on E: Exception do ShowMessage(E.Message)'. EAbort is a sub-class of Exception, so generic handlers catch it. Fix: add 'if E is EAbort then raise' before showing the message, to re-raise EAbort and let the VCL handle it silently.
Can I use EAbort in a console application?
Yes, but EAbort is not silenced automatically in console apps — there is no VCL Application handler. In a console app, EAbort propagates like any other exception and will crash your program if uncaught. You need to catch it explicitly in your main block: except on EAbort do; — the semicolon means 'do nothing'.