For multiple types turning into one variant: you can either impl From for the others yourself, or you can have another enum with variants for them and have thiserror generate the From impl. I usually have lots of enums, at least one per module, sometimes even one per function, that form a tree. The errors you design should relate to the action that was being tried, and only encapsulate the lower error as context information.
I see you're using strings. You can do that, but then you'll lose control over formatting, and additional context info that might be contained in them.
Designing errors isn't trivial and requires some experience. Try some things and over time you'll see what works best.
#[derive(Debug, thiserror::Error)]
pub enum MyError {
#[error("Failed to do the thing, blabla, put something clear here")]
DoingTheThing(#[from] LibraryError)
}
And then you can just do foo(a, b)? because there's now a From impl for MyError from LibraryError.
I assume you're asking this because you'd like to reduce the impact of that kind of behaviour.
If that is your goal, then it would be best attained by going to psychotherapy. NCD/ASPD cannot be healed, but it can be treated and its effects greatly reduced, assuming you're willing to put in the work.
Let me put it this way: When I am in a restaurant/bar/pub/similar place, I can't follow the conversations of the people at the other tables. However, with US-Americans, I understand every single word, even if they're two tables over. Their normal conversational volume is just so much higher. To them, it is completely normal, and they don't seem to notice. To us, they're speaking very loudly, as if everyone were hard of hearing, or as if we were on a construction site.
There's a not-so-small difference between weird and annoying leftovers in specific areas and going all in with it in everyday life and still teaching it to every child.
For example, in Switzerland, no employee may work more than 45 hours per week in the normal case (there are exceptions). Even if the employee and employer agree to ignore this, the employer will get absolutely rekt by the (mandatory) insurance if anything happens to the employee - even an accident in the employee's free time.
It's not the same, but similar, in other European countries.
In Deutschland gibt es eine gesetzliche wöchentliche Höchstarbeitszeit. Ja die kann in Notfällen undso überschritten werden, aber die Leute arbeiten nicht oft 24h am Stück ohne Pause als wäre das etwas völlig normales
En France vous avez des lois qui limitent le maximum des heures travaillés par semaine. Oui dans des cas éxtraordinaire c'est possible de les ignorer, mais c'est une grande difference en comparaison avec les états-unis, où ils travaillent pendant 24h sans pause comme c'est une chôse normal
Even more so. The slop needs to be checked more thoroughly than human written code, because they are good at generating something that looks reasonable at first glance, but at closer inspection is actually bullshit.
Maybe they have a small freezer, idk. We have a vegetable subscription from a local farm, it's great. Vegetables get delivered once a week, and they're so fresh we can really taste the difference.
So pretty!