-
Notifications
You must be signed in to change notification settings - Fork 34
Open
Milestone
Description
The C API translates the C++ exceptions to integer values (see NK_C_API.cc:get_with_status). For instances of CommandFailedException, the last_command_status field is used for the conversion. This field is typically set to a value of the stick10::command_status enum. But LongOperationInProgressException, which is a subclass of CommandFailedException, uses stick10::device_status::busy (= 1) instead. This overlaps with the wrong_CRC variant of the command_status enum, making it impossible to distinguish the two errors as a user of the C API.
Possible solutions:
- Add a new value to the
stick10::command_statusenum and use it forLongOperationInProgressException. - Add a special case for the
LongOperationInProgressExceptionto theget_with_statusfunction and return a unique ID for it. (I don’t really like this option because it makes the error handling code more complicated.) - Let
LongOperationInProgressExceptioninherit fromDeviceCommunicationExceptioninstead ofCommandFailedExceptionand define a new ID.
Metadata
Metadata
Assignees
Labels
No labels