Macro

Error

macro Error(target: UnionDeclarationSyntax, context: AttachedMacroContext) on Type -> ()

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

Derives Raven's standard error contract for a union.

Error makes the union implement System.IError. When the union does not declare its own Message property, the macro supplies one using the union's case-aware textual representation. It also supplies a null Cause when the union does not declare one.

Example

import Raven.Macros.*

#[Error]
union FileError {
    case NotFound(path: string)
    case AccessDenied
}