Macro

ErrorMessage

macro ErrorMessage(message: ExpressionSyntax, target: CaseDeclarationSyntax, context: AttachedMacroContext) on Type -> ()

Namespace: Raven.Macros
Assembly: Raven.Macros.dll
Source file: ErrorMessage.rvn

Supplies the message for one case of a union derived with #[Error].

The message is Raven expression syntax and is evaluated in the matching case's payload scope. This allows ordinary string interpolation to refer to payload names without introducing a separate formatting language.

Example

#[Error]
union ParseError {
    #[ErrorMessage("Invalid value: $value")]
    case InvalidValue(value: string)
}