---
id: object/codeunit/29
type: object
title: Codeunit 29 "Error Message Handler"
summary: Codeunit 29 "Error Message Handler" in Base Application (System.Utilities). 10 public procedures, 2 events, 10 event subscribers. Present since at least BC23, still in BC30.
tier: official
language: en
tags:
  - codeunit
  - base application
versions:
  introduced: null
  last_changed: null
  deprecated: null
review:
  state: derived
  by: null
  at: null
  flags: []
generated:
  at: "2026-10-11T00:31:51.816Z"
  pipeline: 0.2.0
  prompts: {}
  input_hash: ea67b56ec3dab59bcd5561088c5c274c7d0b5f87973b874690ea296267d1a2c0
evidence:
  - kind: code
    url: https://github.com/microsoft/BCApps/blob/ea08af5ef2d6a9b5c5af4a029288abbe2c883220/src/Layers/W1/BaseApp/Modules/System/ErrorMessage/ErrorMessageHandler.Codeunit.al
    title: src/Layers/W1/BaseApp/Modules/System/ErrorMessage/ErrorMessageHandler.Codeunit.al (releases/29.x)
    date: null
    commit: ea08af5ef2d6a9b5c5af4a029288abbe2c883220
    t: null
    quote: null
links:
  learn: []
  objects: []
  features: []
  topics: []
  localizations: []
  videos: []
  posts: []
  guidelines: []
object_type: codeunit
object_id: 29
name: Error Message Handler
namespace: System.Utilities
app: Base Application
extends: null
first_version: "23"
last_version: "30"
present_in:
  - "23"
  - "24"
  - "25"
  - "26"
  - "27"
  - "28"
  - "29"
  - "30"
changed_in: []
source_major: "29"
obsolete: null
countries: []
ms_search_form_ids: []
counts:
  fields: 0
  procedures: 26
  events: 2
  subscribers: 10
relations:
  out: 0
  referenced_by: 0
  pages: 0
  extended_by: 0
  event_subscribers: 0
  calls: 1
  called_by: 22
  implements: 0
---

# Codeunit 29 "Error Message Handler"

> Codeunit 29 "Error Message Handler" in Base Application (System.Utilities). 10 public procedures, 2 events, 10 event subscribers. Present since at least BC23, still in BC30.

Base Application · System.Utilities · BC23-30 · [source at ea08af5e](https://github.com/microsoft/BCApps/blob/ea08af5ef2d6a9b5c5af4a029288abbe2c883220/src/Layers/W1/BaseApp/Modules/System/ErrorMessage/ErrorMessageHandler.Codeunit.al) · facts from BC29

## Events published

- `OnBeforeActivateErrorMessageHandler(var ErrorMessageHandler: Codeunit "Error Message Handler")` (integration)
- `OnAfterRegisterErrorMessages(var ErrorMessage: Record "Error Message"; var RegisterID: Guid)` (integration)

## Event subscriptions

- OnGetFirstContextIDHandler subscribes to Codeunit "Error Message Management" OnGetFirstContextID
- OnGetErrorsHandler subscribes to Codeunit "Error Message Management" OnGetErrors
- OnGetLastErrorID subscribes to Codeunit "Error Message Management" OnGetLastErrorID
- OnGetLastErrorMessageRecord subscribes to Codeunit "Error Message Management" OnGetLastErrorMessageRecord
- OnGetCachedLastErrorID subscribes to Codeunit "Error Message Management" OnGetCachedLastErrorID
- OnLogErrorHandler subscribes to Codeunit "Error Message Management" OnLogError
- OnLogSimpleErrorHandler subscribes to Codeunit "Error Message Management" OnLogSimpleError
- OnFindActiveSubscriberHandler subscribes to Codeunit "Error Message Management" OnFindActiveSubscriber
- OnPushContextHandler subscribes to Codeunit "Error Message Management" OnPushContext
- OnLogLastErrorHandler subscribes to Codeunit "Error Message Management" OnLogLastError

## Procedures

- `AppendTo(var TempErrorMessageBuf: Record "Error Message" temporary): Boolean`
- `Activate(var ErrorMessageHandler: Codeunit "Error Message Handler"): Boolean`
- `ShowErrors(): Boolean`
- `NotifyAboutErrors()`
- `InformAboutErrors(ErrorHandlingOptions: Enum "Error Handling Options")`
- `RegisterErrorMessages(): Guid`
- `RegisterErrorMessages(ClearError: Boolean): Guid`
- `WriteMessagesToFile(FileName: Text; ThrowLastError: Boolean): Boolean`
- `GetErrorCallStack(): Text`
- `HasErrors(): Boolean`

Plus 4 local procedures.

## Triggers

OnRun

## Calls

From the extracted call graph of BC29 (graphify-al on the snapshot checkout): calls whose target is known from a declared type or an `Object::"Name"` argument. Interface dispatch and calls through events are not counted, so the list is not complete.

- [Codeunit 1511 "Notification Lifecycle Mgt."](../codeunit/1511.md) (2 calls: `ShowNotification → RecallNotificationsForRecord`, `ShowNotification → SendNotification`)

## Called by

- [Codeunit 1000 "Job Calculate WIP"](../codeunit/1000.md) (2 calls: `JobCalcWIP → HasErrors`, `JobCalcWIP → ShowErrors`)
- [Codeunit 393 "Reminder-Issue"](../codeunit/393.md) (2 calls: `OnRun → HasErrors`, `OnRun → ShowErrors`)
- [Codeunit 5286 "Data Check Mgt. SAF-T"](../codeunit/5286.md) (2 calls: `OnRun → HasErrors`, `OnRun → ShowErrors`)
- [Codeunit 8800 "Custom Layout Reporting"](../codeunit/8800.md) (2 calls: `ProcessReport → HasErrors`, `ProcessReport → ShowErrors`)
- [Report 5692 "Calculate Depreciation"](../report/5692.md) (2 calls: `OnPostReport → HasErrors`, `OnPostReport → ShowErrors`)
- [Report 5707 "Batch Post Transfer Orders"](../report/5707.md) (2 calls: `RunPostBatchTransferOrder → HasErrors`, `RunPostBatchTransferOrder → NotifyAboutErrors`)
- [Codeunit 1371 "Sales Batch Post Mgt."](../codeunit/1371.md) (1 call: `RunWithUI → ShowErrors`)
- [Codeunit 1372 "Purchase Batch Post Mgt."](../codeunit/1372.md) (1 call: `RunWithUI → ShowErrors`)
- [Codeunit 1380 "Batch Processing Mgt."](../codeunit/1380.md) (1 call: `BatchProcessGenJournalLine → ShowErrors`)
- [Codeunit 19 "Gen. Jnl.-Post Preview"](../codeunit/19.md) (1 call: `PreviewStart → ShowErrors`)
- [Codeunit 373 "Bank. Acc. Recon. Post Preview"](../codeunit/373.md) (1 call: `PreviewStart → ShowErrors`)
- [Codeunit 443 "Sales-Post Prepayment (Yes/No)"](../codeunit/443.md) (1 call: `PostPrepmtDocument → ShowErrors`)
- [Codeunit 445 "Purch.-Post Prepmt. (Yes/No)"](../codeunit/445.md) (1 call: `PostPrepmtDocument → ShowErrors`)
- [Codeunit 449 "Job Queue Start Codeunit"](../codeunit/449.md) (1 call: `OnRun → RegisterErrorMessages`)
- [Codeunit 450 "Job Queue Error Handler"](../codeunit/450.md) (1 call: `LogError → RegisterErrorMessages`)
- [Codeunit 5261 "Audit File Export Mgt."](../codeunit/5261.md) (1 call: `PreExportCheck → ShowErrors`)
- [Codeunit 6620 "Copy Document Mgt."](../codeunit/6620.md) (1 call: `CopySalesDoc → NotifyAboutErrors`)
- [Codeunit 7092 "Expense Report Batch Post Mgt."](../codeunit/7092.md) (1 call: `RunWithUI → ShowErrors`)
- [Codeunit 8811 "Customer Statement via Queue"](../codeunit/8811.md) (1 call: `OnRun → AppendTo`)
- [Table 36 "Sales Header"](../table/36.md) (1 call: `SendToPosting → ShowErrors`)
- [Table 38 "Purchase Header"](../table/38.md) (1 call: `SendToPosting → ShowErrors`)
- [Table 5900 "Service Header"](../table/5900.md) (1 call: `SendToPostWithLines → ShowErrors`)

## Across versions

- Present in: BC23-30
- Changed (declaration) in: none

Source: AL metadata extracted from the code (names, ids, signatures, properties); no code bodies (D10).

## Ask your agent

Procedure bodies are not stored here (D10). The call sections above are our own, per object, from the BC29 call graph. For a procedure body or the calls of one procedure, ask bc-code-atlas (external, by Stefan Maron, MIT; default corpus w1-28), which the bc-observatory plugin connects: `bcatlas_resolve_node(object_type: "codeunit", object_name: "Error Message Handler")`, then `bcatlas_get_procedure_body` or `bcatlas_get_neighbors` on the returned id.
