POCS icon indicating copy to clipboard operation
POCS copied to clipboard

SDKDriver class ._call_function() methods should raise custom(ised) exceptions

Open AnthonyHorton opened this issue 5 years ago • 0 comments

Part of the problem is that ._call_function() doesn't (currently) make any distinctions based on which error code it gets back from the driver library, it just raises a generic RuntimeError for everything and embeds the error name in the exception's sole argument. This makes it a bit awkward for code that's catching these exceptions to respond in the most appropriate way. What ._call_function() should probably be doing is raising RuntimeError with multiple arguments e.g. (human readable summary, SDK function name, error code, error name) so that it's easier for higher level code to work out what has happened or, even better, ._call_function() should be raising different custom exceptions for each type of error, again with multiple attributes to make it easy to write conditional error handling code. This all applies equally to the corresponding parts of the SBIG and FLI camera library classes too, of course.

_Originally posted by @AnthonyHorton in https://github.com/render_node/MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDMzMjk1MTc5OQ==/comments/review_comment

AnthonyHorton avatar Oct 09 '19 12:10 AnthonyHorton