-
Notifications
You must be signed in to change notification settings - Fork 2
#error
Marcus edited this page Oct 28, 2015
·
1 revision
The #error
directive throws an exception. This can be useful to enforce invariants.
$$#error <message> /$$
$$#error$$
<message_body>
$$/error$$
<message>: any string not containing Jefferson markers
<message_body>: any string, will be compiled as Jefferson "code"
- May be empty: yes
- May be nested: yes (note: this is probably not very useful)
By default the exception type used is Exception
. It is possible to override this behaviour by passing the relevant exception type to the constructor of the directive. This exception type should contain a public constructor should accepting a single String
argument.
$$#if HAVE_FOO and HAVE_BAR$$
$$#error Cannot have foo and bar at the same time. /$$
$$/if$$