Skip to main content
Includes API for attaching annotations such as warning messages to constructs.

Methods

NameDescription
addErrorAdds an { “error”: < message > } metadata entry to this construct.
addInfoAdds an info metadata entry to this construct.
addWarningAdds a warning metadata entry to this construct.

addError

public addError(message: string): void
Adds an { “error”: < message > } metadata entry to this construct. The toolkit will fail synthesis when errors are reported.

messageRequired

  • Type: string
The error message.

addInfo

public addInfo(message: string): void
Adds an info metadata entry to this construct. The CLI will display the info message when apps are synthesized.

messageRequired

  • Type: string
The info message.

addWarning

public addWarning(message: string): void
Adds a warning metadata entry to this construct. The CLI will display the warning when an app is synthesized. In a future release the CLI might introduce a —strict flag which will then fail the synthesis if it encounters a warning.

messageRequired

  • Type: string
The warning message.

Static Functions

NameDescription
ofReturns the annotations API for a construct scope.

of

import { Annotations } from 'cdktn'

Annotations.of(scope: IConstruct)
Returns the annotations API for a construct scope.

scopeRequired

  • Type: constructs.IConstruct
The scope.