@Error
and @Warn
Directives
Cause custom compiler errors and warnings.
Syntax
@Error message
or
@Warn message
Parts
message
- A string literal with the text to show.
Instructions
The directive @Warn
causes the compiler to show a warning message.
The message usually is a warning that there is a possible problem in the code.
A warning usually does not stop the compiler.
The directive @Error
shows an error message from the compiler.
You cannot ignore an error message, because it always causes the compiler to stop.
Usually you use the directives @Warn
and @Error
with conditional compilation (Const If…Else
).
There could be unusual conditions when it is applicable to give a warning of some problem without condition.
But we do not recommend it.
Examples
Const If Win32 Then
' Windows-only code goes here.
Else If Linux Or MacOS Then
' Unix-like code goes here.
Else
@Error "Platform not supported"
End If