driplineorg / driplineorg/dripline-python

Standardize exception handling

Open
#166 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
3
Forks
6
PR merge metrics
No merged PRs in 30d

Description

Exception handling in dl-cpp: https://github.com/driplineorg/dripline-cpp/issues/103

The primary execution of most actions in dl-py takes place in C++, so most error handling will end up in the C++ code. Between C++ and Python the typical sequence of stages is `Caller (Python) --> Execution (C++) --> Details (Python)`. `Details` includes things like doing calibrations. Most time is spent in the `Execution` and `Details` stages, and the `Execution` stage is typically responsible for the final error handling and making decisions about whether to exit the application. So we need to ensure that the error handling drops back to the C++ in the right ways.

### Caller stage
* dl-serve
* Calls `service::listen()` and checks boolean return
* Raises RuntimeError to exit if necessary

### Execution stage
See https://github.com/driplineorg/dripline-cpp/issues/103

### Details stage
* ✅ AlertConsumer
* Does not raise exceptions
* :x: Calibrate
* `calibration()`
* raises `exceptions.DriplineValueError`
* This is the calibration decorator, which will be called when responding to a request
* Therefore this is not the right use of `DriplineValueError`
* ✅ Endpoint
* Several functions
* Raises only ThrowReply
* :question: Entity
* Several functions
* Raise ValueError
* **Question** Is this right? Are these caught somewhere?
* ✅ Interface
* `_send_request()`
* Raises DriplineError
* Called by `get()`, `set()`, and `cmd()`
* Not caught
* Will pass exception up to the user of Interface
* ✅ ReturnCodes.py
* Does not raise exceptions
* ✅ ThrowReply
* Does not raise exceptions

I have not checked any code in Implementations.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.