@Error and @Warn Directives

Generate custom compiler error messages and warnings.


@Error message
@Warn message


The text to be displayed.


The @Warn directive simply causes the compiler to display its message whenever it is encountered in code. The message should be a warning that there is a potential problem in the code. A warning does not interfere with the compilation process.

The @Error directive, likewise, displays a message from the compiler. However, an error message cannot be ignored because it will always cause the compilation process to fail.

The @Warn directive, in general, and the @Error directive, in particular, are not very useful outside of conditional compilation directives (@If...Then...@Else). There might be rare instances when it makes sense for you to unconditionally warn of some problem; although, doing so is seldom encouraged by professionals.

The message that is displayed is taken verbatim from the directive and includes all printable text up to the end of the line. Consequently, comments you place on the same line are regarded as part of the message text and will be displayed as such.


@If Win32
  ' Windows-specific stuff
@ElseIf Linux Or MacOS
  ' Unix-like stuff
@Error Platform not supported

See also