Supported Platforms
terminate
Syntax
terminate expression;
terminate { /* body */ }
Release Information
Statement introduced in version 1.1 of the SLAX language, which is supported in Junos OS Release 12.2 and later releases.
Description
Generate an error message that is immediately displayed to the user, and exit the script.
Junos OS op scripts, event scripts, and commit scripts prepend "error:" to the displayed message when generating text output. When generating XML output, the scripts place the output inside a <message> element, which is enclosed in an <xmn:error> element.
If the terminate statement is used in a commit script, the script will generate two errors and terminate the script and the commit process. If the terminate statement is used in an event script, the script writes the message to the output file, if one is configured, and terminates the script.
Attributes
expression | — | XPath expression or string emitted as output. |
SLAX Example
if (not(valid)) { terminate "The " _ name() _ " node is not valid. Exiting script."; }