Detecting And Recording Macro Errors; Detectable Macro Errors - Juniper SYSTEM BASICS - CONFIGURATION GUIDE V 11.1.X Configuration Manual

System basics configuration guide software for e series broadband services routers
Table of Contents

Advertisement

host1# macro verbose macro1.mac callAnotherMacro
host1#!Macro 'callAnotherMacro' in the file 'macro1.mac' starting execution (Id: 55)
macro macro2.mac macroName2 5 string1
!Macro 'macroName2' in the file 'macro2.mac' starting execution
!Macro 'macroName2' in the file 'macro2.mac' ending execution
host1#!Macro 'callAnotherMacro' in the file 'macro1.mac' ending execution (Id: 55)
The invoked macro cannot invoke a third macro from another file. Only a single level
of invocation is supported.

Detecting and Recording Macro Errors

You can control how a macro responds when an error occurs during execution. By
creating and adding an onError macro to your macro file, you can specify that, on
the occurrence of an error, macro execution within the current macro stops and the
onError macro is invoked. An onError macro can call other macros. If another error
occurs after the onError macro is invoked, macro execution stops again and the
onError macro is invoked again. This process continues either until the onError macro
completes or until reaching the recursion limit of 10.

Detectable Macro Errors

CLI macros detect various errors when a macro is executed. Some of these errors
are detected without the use of an onError macro; they include the following:
The following errors are detected only when a CLI macro file contains an onError
macro:
In addition to these detectable errors, you can use the following environment
commands to return textual error information to the macroData log file:
CAUTION: Though you can use the env.getErrorCommand and env.getErrorStatus
commands in any macro, the only appropriate place from which to execute these
commands is from an onError macro.
Macro file not found
Macro not found
Macro compilation error
Macro does not complete error due to excessive looping or recursion
Syntactic error in executed CLI command
Runtime error in executed CLI command
env.getErrorCommand
env.getErrorStatus
Chapter 8: Writing CLI Macros
Detecting and Recording Macro Errors
491

Advertisement

Table of Contents
loading

This manual is also suitable for:

Junose 11.1

Table of Contents