Conversation
This makes it possible for library users to match on errors.
Errors are also more descriptive now:
Error: I/O error while reading
Caused by:
0: libusb error
1: Overflow
Compared to what it was before:
Error: other error
For some reasoning, see https://kazlauskas.me/entries/errors
|
JFYI I noticed this PR, I'll try to take a look later this week |
|
I like the general idea of this. What I'm still deliberating is the level of granularity which the library should expect the consumer to care about, i.e. should What's your usecase? Are you building something OSS that we could take a look at in parallel? I utilized the library in a(n unfortnuately internal) project and my usecase was rather simple and not very error prone (the device's state was more or less predictable) so this didn't hit me before. I know @quic-bjorande is cooking something too - maybe he can comment on any roadblocks he hit current approach too |
|
I think the granularity is required for possible users to check for the level of the failure in their specific use case. They could retry depending on the error (i.e. buggy firehose loader vs USB disconnected) and give even more descriptive errors to end users. As noted in the linked blog article, thiserror also forces the context to be added, so error messages are more descriptive.
The program can't know which state a device is in, any may even be restarted/run while a Firehose loader is running, so I'm all for having Sahara and Firehose functionality separate. About that specific function, I'm not sure.
Just testing currently. The ABL of a device seems to brick the boot partition with some fastboot commands, and I've just built an error-safe way to reflash the boot partition. |
|
The blog post does also mention this, which may or may not be of concern to you:
|
This makes it possible for library users to match on errors.
Errors are also more descriptive now:
Compared to what it was before:
For some reasoning, see https://kazlauskas.me/entries/errors