Add a comprehensive error management architecture
Eikix opened this issue · comments
Generalize usage of thiserror
crate in the repository.
I'd like to contribute to this issue :)
Sure! What is your plan?
I dont have any real plan, but I have thoughts about integrating the thiserror
crate into the project.
First would be to convert every errors in Result
into an instance of thiserror
.
Then, we have another form of error that we might want to manage: test results.
Currently, tests result types are (String, bool)
. We could convert this into a Result that use thiserror, but maybe we should make our own Result datatype... like:
enum Status {
SUCCESS,
FAILURE
}
struct TestResult<E> {
message: String,
status: Status,
error: Option<E>
}
With out own implementation of Display to get the correct pretty print.
This might be clearer than using thiserror
for test result (because a failed result is not an error, and we might lose in readability if we do this). Tell me what you think of this ?
Hi, I started implementing a thiserror
architecture, you can check it out if you'd like. If you think you'd like to implement TestResult instead, let me know:)
Def agree on the Status
for tests,
even simply alias true
and false
in order to keep the option to use boolean operations?
enum TestStatus {
SUCCESS = true,
FAILURE = false
}
Hey, I took a look and it's pretty good :) What is left to do ?
Yeah I thing bool aliases are good, I would definitely work on it if you need !
You can tackle bool aliasing:)! It'll be good enough for now
Okay ! I'll work on it