Refactor Future to have a parameterized error type