emit_error() Function (Python)
Syntax
Python Syntax
Release Information
Function introduced in Junos OS Release 16.1R1 on QFX Series switches and MX Series, PTX Series, and T Series routers.
Function introduced in Junos OS Release 17.1R1 on ACX500, ACX1000, ACX1100, ACX2000, ACX2100, ACX2200, and ACX4000 routers, and EX Series switches.
Function introduced in Junos OS Release 17.3R1 on SRX1500, SRX4100, SRX4200, SRX5400, SRX5600, and SRX5800 devices and vSRX instances.
Function introduced in Junos OS Release 18.3R1 on ACX5048 and ACX5096 routers.
Description
Generate an error message on the console from a Python automation script. The error message is preceded by the text error: .
When used in commit scripts, this function also causes the commit operation to fail.
If the jcs.emit_error
string
argument includes a null character sequence (\0
), the script generates an Invalid number of arguments error. Additionally, if the string argument consists exclusively
of an empty string or escape sequences (\n \t \b \v \f
\r
) and spaces, Junos OS does not emit any message.
Parameters
string
—String describing the error.Usage Examples
import jcs def main(): ... jcs.emit_error("Error message from a Python automation script") if __name__ == '__main__': main()