{"title":"Dialog.Error(ErrorInfo) Method","url":"https://jonas-paprotka.de/docs/dev-itpro/developer/methods-auto/dialog/dialog-error-errorinfo-method/","by":"JOP-AL","license":"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.","credit":"Microsoft Corporation, CC BY 4.0","origin":"https://learn.microsoft.com/en-us/dynamics365/business-central/dev-itpro/developer/methods-auto/dialog/dialog-error-errorinfo-method","source":{"name":"Business Central developer and IT pro docs","repo":"https://github.com/MicrosoftDocs/dynamics365smb-devitpro-pb","commit":"828b6ee72fcd75755627cd6011f3d20899217ab2","date":"2026-11-19"},"checked":"2026-11-19","description":"Displays an error message and ends the execution of AL code.","date":"2026-10-01","meta":{"topic":"reference"},"outline":[{"level":2,"title":"Syntax","slug":"syntax","at":220,"chars":129},{"level":2,"title":"Parameters","slug":"parameters","at":349,"chars":162},{"level":2,"title":"Remarks","slug":"remarks","at":511,"chars":317},{"level":2,"title":"Guidelines for error messages","slug":"guidelines-for-error-messages","at":828,"chars":448},{"level":2,"title":"Example","slug":"example","at":1276,"chars":1147},{"level":2,"title":"Related information","slug":"related-information","at":2423,"chars":277}],"text":"> Version: _Available or changed with runtime version 3.0._\nDisplays an error message and ends the execution of AL code.\n> NOTE\n> From runtime version 8.0 and onward, this method is supported in Business Central online.\n## Syntax\n```al\n Dialog.Error(Message: ErrorInfo)\n```\n> NOTE\n> This method can be invoked without specifying the data type name.\n## Parameters\nMessage\nType: ../errorinfo/errorinfo-data-type\nThe ErrorInfo structure that contains error message, error type, verbosity, and data classification.\n## Remarks\nThe window is automatically sized to hold the longest line of text and total number of lines.\n> NOTE\n> 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.\n## Guidelines for error messages\nImproving 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.\nFor guidance on how to formulate good error messages, see Error message best practices - what to say?<../../devenv-error-handling-guidelines>.\n## Example\nThis example shows how to use the Error method.\n```al\nprocedure InitializeFromCurrentApp()\nvar\n    DoNotBlockErrorInfo: ErrorInfo;\n    IsBlocked: Boolean;\nbegin\n    IsBlocked := // Some logic that determines whether the account is blocked\n\n    if IsBlocked then\n    begin\n        // Setup ErrorInfo object\n        DoNotBlockErrorInfo.Title('Could not block the account.');\n        DoNotBlockErrorInfo.Message('Finance Account 1230 must not be blocked.');\n        DoNotBlockErrorInfo.DetailedMessage('Some additional information that can help the person troubleshooting this issue.');\n        // Add more properties for ErrorInfo depending on the scenario\n        //   Maybe add a title to the error message\n        //   Maybe make the error message actionable (add fix-it or show-it actions)\n\n        Error(DoNotBlockErrorInfo);\n\n        // Code execution stops here\n        Message('This line will never run');\n    end;\nend;\n```\nThe error window displays the following:\nCould not block the account\nFinance Account 1230 must not be blocked.\nThe Error method causes execution of AL code to stop. dialog-message-method is never executed.\n## Related information\nError handling overview<../../devenv-al-error-handling>\nAnalyzing Error method telemetry<../../../administration/telemetry-error-method-trace>\ndialog-data-type\nGet started with AL<../../devenv-get-started>\nDeveloping extensions<../../devenv-dev-overview>"}