0% found this document useful (0 votes)
31 views22 pages

Error Handling in Scripting Explained

The document discusses error trapping and handling in scripts, highlighting the difference between errors and exceptions, and the importance of enabling traps for effective error management. It explains how to add traps, capture errors, and store them for review. The document also emphasizes the use of the -EA parameter and provides insights into the behavior of traps within functions.

Uploaded by

shrikantnpar
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
31 views22 pages

Error Handling in Scripting Explained

The document discusses error trapping and handling in scripts, highlighting the difference between errors and exceptions, and the importance of enabling traps for effective error management. It explains how to add traps, capture errors, and store them for review. The document also emphasizes the use of the -EA parameter and provides insights into the behavior of traps within functions.

Uploaded by

shrikantnpar
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 22

Error Trapping and Handling in

scripts
Overview
• Errors vs Exception
• Error Action
• Trapping exceptions
• Exiting the trap
• Following the trap scope
• Reviewing errors
• Capturing errors
• Adding traps to scrip t
Create a script n give computer name as
does not exits….This is called as error
We are adding a trap n executing but v c is
error but not trap…..can U tell me Y
The reason trap didn’t work
• Bcoz it is disabled by default n we need to
enable.
• By default it throws the error n not the
exception.
• The trap is = execption
• Lets enable it in next slide
Vallaaaahhh its woking
Use –EA parameter instead of at global
level
• Yeah That Red Color message is still dere….I
need it to go away
• Check the next screen
Valaaaahhhh I could c U all smiling
Its clearly going back at the top n closing
function…goes to trap…...n goes to next function
Add a Trap inside the function n Trap inside
functions runs n later continues in same function
• Lets learn something more….in the next slide
$Error contains all the error
You can also store that if any error occurs
store it to a variable
Summary
Review
• Errors vs Exception
• Error Action
• Trapping exceptions
• Exiting the trap
• Following the trap scope
• Reviewing errors
• Capturing errors
• Adding traps to scrip t

You might also like