# Dialog.Error(ErrorInfo) Method
> Version: _Available or changed with runtime version 3.0._
Displays an error message and ends the execution of AL code.
> NOTE
> From runtime version 8.0 and onward, this method is supported in Business Central online.
## Syntax
```al
 Dialog.Error(Message: ErrorInfo)
```
> NOTE
> This method can be invoked without specifying the data type name.
## Parameters
Message
Type: ../errorinfo/errorinfo-data-type
The ErrorInfo structure that contains error message, error type, verbosity, and data classification.
## Remarks
The window is automatically sized to hold the longest line of text and total number of lines.
> NOTE
> Use this version of the Dialog.Error method compared to the older Dialog.Error(Text [, Any,...]) Method<dialog-error-string-joker-method> that only supports inputing a string for the error message body.
## Guidelines for error messages
Improving error handling and error messages reduces friction for the users and highly impacts the user experience. Clear and informative error messages help users understand what went wrong and how to correct it, which reduces frustration, and improves user satisfaction.
For guidance on how to formulate good error messages, see Error message best practices - what to say?<../../devenv-error-handling-guidelines>.
## Example
This example shows how to use the Error method.
```al
procedure InitializeFromCurrentApp()
var
    DoNotBlockErrorInfo: ErrorInfo;
    IsBlocked: Boolean;
begin
    IsBlocked := // Some logic that determines whether the account is blocked

    if IsBlocked then
    begin
        // Setup ErrorInfo object
        DoNotBlockErrorInfo.Title('Could not block the account.');
        DoNotBlockErrorInfo.Message('Finance Account 1230 must not be blocked.');
        DoNotBlockErrorInfo.DetailedMessage('Some additional information that can help the person troubleshooting this issue.');
        // Add more properties for ErrorInfo depending on the scenario
        //   Maybe add a title to the error message
        //   Maybe make the error message actionable (add fix-it or show-it actions)

        Error(DoNotBlockErrorInfo);

        // Code execution stops here
        Message('This line will never run');
    end;
end;
```
The error window displays the following:
Could not block the account
Finance Account 1230 must not be blocked.
The Error method causes execution of AL code to stop. dialog-message-method is never executed.
## Related information
Error handling overview<../../devenv-al-error-handling>
Analyzing Error method telemetry<../../../administration/telemetry-error-method-trace>
dialog-data-type
Get started with AL<../../devenv-get-started>
Developing extensions<../../devenv-dev-overview>

Copyright (c) Microsoft Corporation. CC BY 4.0, https://creativecommons.org/licenses/by/4.0/; code samples MIT. From https://learn.microsoft.com/en-us/dynamics365/business-central/dev-itpro/developer/methods-auto/dialog/dialog-error-errorinfo-method, MicrosoftDocs/dynamics365smb-devitpro-pb at 828b6ee (2026-11-19). Changed: includes filled in, links to this site, and for agents shortened without dropping a fact. https://jonas-paprotka.de/docs/dev-itpro/developer/methods-auto/dialog/dialog-error-errorinfo-method/
