The current error handling relies heavily on string matching:
e.to_string().contains("empty") || e.to_string().contains("no hashes") || e.to_string().contains("invalid input")
As @marcelamelara noted, it would be better to check error types. I agree, and while we might still need to partially rely on string content for some custom errors, we should aim to introduce a proper error type to improve code reliability.