Pcornel
Automation · Error Handling

Exceptions

Cheat sheet · https://pcornel.dk/topic.php?topic=5972

Back to the Topic

Answer

Exceptions are errors raised by code that can be caught and handled, such as try/catch/finally in PowerShell and Python. Catch specific exceptions and include useful context in the message.

Remember

  • Catch specific exception types.
  • Add context to error messages.
  • Re-raise exceptions you cannot handle.

First checks

  • try/except, try/catch, block/rescue usage — mechanisms
  • Specific exception types — precision
  • Context in error messages — diagnostics

Verify in this order

exception → handler → log/re-raise

Where it usually breaks

Input/desired state → request accepted → job/task terminal status → target object read-back → effective runtime state → original workload → regression/rollback readiness.

Read-only verification commands unless stated otherwise. Confirm syntax for your platform and release. Full reference: https://pcornel.dk/topic.php?topic=5972

Confirmation

Confirm action

Continue?