Expand Minimize
This documentation is part of the BETA release and subject to change.

Do not use empty Catch Blocks

Empty catch blocks are a poor design. Always output an error and use error handling in the event of an exception.

CheckId SPC019101
TypeName DoNotUseEmptyCatchBlocks
Severity CriticalWarning
Type PoShFile

Bad Practice

try
{}
catch
{}
Good Practice
try
{}
catch [ExceptionTypeException]
{
  Write-Debug 'An ExceptionTypeException has occurred'
}

Disclaimer: The views and opinions expressed in this documentation and in SPCAF do not necessarily reflect the opinions and recommendations of Microsoft or any member of Microsoft. SPCAF and RENCORE are registered trademarks of Rencore. All other trademarks, service marks, collective marks, copyrights, registered names, and marks used or cited by this documentation are the property of their respective owners.