Errors are used to communicate unexpected conditions or exceptional circumstances. Errors often contain useful information that can be used to diagnose a condition.
PowerShell has two different types of errors, terminating and non-terminating, and several different ways to raise and handle them.
During the course of this chapter, self-contained blocks of code are described as scripts. The terms function, ScriptBlock, and script can be considered interchangeable in the context of error handling.
The following topics are covered in this chapter:
- Error types
- Error actions
- Raising errors
- Catching errors