Ticket #960 (new task)

Opened 3 years ago

Setting errors versus throwing exceptions

Reported by: janez Owned by: janez
Milestone: 3.0 Component: other
Severity: minor Keywords:
Cc: Blocking:
Blocked By:

Description

As a general principle, functions that return PyObject * will set the error (e.g. PyErr_Format) and functions that return POrange or TOrange * will raise exceptions. Check that the code conforms to this (and fix it) ... or change the principle. ;)

Rationale: say that some code calls

ex = TExample::fromDomainAndPyObject(domain, item);

Should it check that ex is not NULL or should it catch exceptions? Orange will use exceptions internally but functions closer to Python will use Python API for setting error messages. Although P- and Py-classes are switched back and forth, the point at which the former convert to the latter is suitable for also defining type of exceptions.

Functions that deal with PyObjects still do not have to catch exceptions, although we need to ensure that any exceptions are eventually caught and "Pythonized".

Note: See TracTickets for help on using tickets.