mavlink / MAVSDK-Java

MAVSDK client for Java.
71 stars 41 forks source link

sdk: throw exception on failure result #7

Closed JonasVautherin closed 5 years ago

JonasVautherin commented 5 years ago

@julianoes: FYI

Some of our functions return a result, e.g. CalibrationResult.SUCCESS or CalibrationResult.BUSY.

In case of success, we just pass the element (calling the RxJava onNext). But in case of failure (everything that is not SUCCESS, IN_PROGRESS or INSTRUCTION), we throw an exception (in the RxJava sense, with onError).

Just as a reminder: we currently have IN_PROGRESS and INSTRUCTION, but in the future (i.e. when the C++ API gets generated), they will be merged into NEXT. Which means that the only success codes will ever be SUCCESS and NEXT.