scriptharness.exceptions module

Scriptharness exceptions.

These exceptions are written with several things in mind:

  1. the exceptions should be unicode-capable in python 2.7 (py3 gets that for free),
  2. the exceptions should differentiate between user-facing exceptions and developer-facing exceptions, and
  3. ScriptHarnessFatal should exit the script.

There may be more exceptions in the future, to further differentiate between errors.

exception scriptharness.exceptions.ScriptHarnessBaseException

Bases: exceptions.Exception

All scriptharness exceptions should inherit this exception.

However, in most cases you probably want to catch ScriptHarnessException instead.

__unicode__()

This method will become __unicode__() in py2 via the @six.python_2_unicode_compatible decorator.

exception scriptharness.exceptions.ScriptHarnessError

Bases: scriptharness.exceptions.ScriptHarnessBaseException

User-facing exception.

Scriptharness has detected an error in the running process.

Since this exception is not designed to always exit, it’s best to catch these and deal with the error.

exception scriptharness.exceptions.ScriptHarnessException

Bases: scriptharness.exceptions.ScriptHarnessBaseException

There is a problem in how scriptharness is being called. All developer-facing exceptions should inherit this class.

If you want to catch all developer-facing scriptharness exceptions, catch ScriptHarnessException.

exception scriptharness.exceptions.ScriptHarnessFatal

Bases: exceptions.SystemExit, scriptharness.exceptions.ScriptHarnessBaseException

User-facing exception.

Scriptharness has detected a fatal failure in the running process. This exception should result in program termination; using try/except may result in unexpected or dangerous behavior.

exception scriptharness.exceptions.ScriptHarnessTimeout

Bases: scriptharness.exceptions.ScriptHarnessException

There was a timeout while running scriptharness.