Skip to main content

Module erc

Module erc 

Source
Expand description

BDEW ERC error codes — structured rejection codes for APERAK and CONTRL.

BDEW ERC codes appear in:

  • APERAK ERC segments: processability errors returned by the receiving party when it cannot process a message (BGM+313).
  • CONTRL ERC segments: syntax and data-validation errors.

This module provides a validated ErcCode newtype, a catalogue of standard code string constants in codes, and ErcAction — a machine-readable recommended automated response for each code. Domain crates match on the ERC code to drive typed ERP automation instead of freeform text parsing.

§Separation of concerns

LayerResponsibility
edi-energyWire-format parsing; raw String from ERC segment
mako-engine::ercValidated type; constants; role-agnostic ErcAction recommendation
Domain cratesProcess-specific match on ErcCode → domain decision
makodErcCode in outbox payload → makoerc CloudEvents extension

§Regulatory sources

  • APERAK AHB 1.0 (FV2025-10-01 / FV2026-10-01) — ERC segment, §2.2/§2.3
  • CONTRL AHB 1.0 (FV2025-10-01 / FV2026-10-01) — ERC segment, §2.2
  • Allgemeine Festlegungen V6.1d (01.04.2026) — §4 rejection handling

§Example

use mako_engine::erc::{ErcCode, ErcAction, codes, recommended_action};

let code = ErcCode::new(codes::E02);
assert!(matches!(
    recommended_action(&code),
    ErcAction::RetryWithCorrection { field: "address" }
));

Modules§

codes
Standard BDEW ERC error code string constants.

Structs§

ErcCode
A BDEW ERC error code from an inbound APERAK or CONTRL.

Enums§

ErcAction
Recommended automated response for a received ERC rejection code.

Functions§

recommended_action
Return the recommended automated ERP action for a received ERC code.