Using a type variable for the in/out parameter

Don't need two different functions
Class constraints for all the error handlers