Modifying the type of Error object that is thrown