Wenzel / libmicrovmi

A cross-platform unified Virtual Machine Introspection API library
https://wenzel.github.io/libmicrovmi/
GNU General Public License v3.0
165 stars 15 forks source link

Better error handling #153

Closed Wenzel closed 3 years ago

Wenzel commented 3 years ago

This PR is a draft to implement precise error types in libmicrovmi.

It tries to improve @rageagainsthepc 's https://github.com/Wenzel/libmicrovmi/pull/152, by removing the DriverError trait and returning only clearly defined enums.

All the trait function definition have been moved to returning Result<T, DriverError> Contrary to what I said https://github.com/Wenzel/libmicrovmi/pull/152#issuecomment-753631651 about boxing errors, i attempted here to remove any boxing, since:

the new trait definition has been implemented on:

Furthermore, the init function for these 2 drivers is now fallible

new error types:

Last thing, I will switch the error types to be #[non_exhaustive] to better understand all the implications when updating an driver error type.