Larusso / unity-version-manager

A commandline application to manage unity versions
Apache License 2.0
23 stars 6 forks source link

Improve error handling Patch I #349

Closed Larusso closed 2 years ago

Larusso commented 2 years ago

Description

I want to switch from error_chain to thiserror crate.The implementation of thiserror looks way nicer and would allow to switch from generated error structs/tuples/enums etc to hand written errors. To start this process I need to find a very centered type which doesn't have to many dependencies etc.

The idea is that most modules will contain a custom error type. I don't want to pass up basic IO errors without context anymore. The error_chain cask supports this as well but I was never really in the clear if I use it correctly.

I started here with the unity::version::hash module as this is self contained and only presents two API's to the outside. Instead of std::io::Error it now returns a custom UnityHashError which wraps the internal errors that might happen in an enum.