Convert connection functions to return error objects.