Skip to main content

error

Macro error 

Source
error!() { /* proc-macro */ }
Expand description

Emits an error-level event with a complete error report.

The first argument is required and must implement ErrorReport. Its display value and source chain are recorded as exception.message; callers do not provide that attribute themselves.

The event name follows the error and must be a string literal. Optional target: and parent: arguments go between the error and name, in that order. Additional attributes follow the name and must use a registered field name and a value implementing RecordAttribute. Append #[nonstandard] to a field value to permit an unregistered name while retaining its canonical encoding. Tracing format specifiers and trailing commas are not supported.

The name is recorded as tracing’s message field, which the OpenTelemetry tracing layer uses as the event name.

use miden_node_utils::tracing::error;

let source = std::io::Error::other("database unavailable");
error!(source, target: "node", "block.store_failed", block.number = 42_u32);