Changes to exceptions in opsi 4.1

As a developer I like it when modules are intuitive to use. One thing that seemed odd to me working with the Python library of opsi was that exceptions were to be found in OPSI.Types. The classes for our objects however are in OPSI.Object.

Coming with opsi 4.1 there is a change in this regard. Most of the opsi-specific exceptions now have their place at OPSI.Exceptions. The exception to this rule are module-specific exceptions that will stay in their modules. This leaves OPSI.Types with the functionality to convert data into specific types.

We also worked on improving the codebase and now use more specific exceptions - in opsi 4.0 only raising a basic Exception was the default in many places. The more specific exceptions make it easier to respond to specific problems or to better understand the nature of an problem.

There are high chances you will not notice any of this changes. This may affect you if you are running custom scripts using exceptions from the OPSI.Types Python module.

The easy way to make sure you can use your scripts with 4.0 and 4.1 is to change the import like the following that allows for running on both version:

    from OPSI.Exceptions import OpsiError
except ImportError:
    from OPSI.Types import OpsiError