Better error handling of curl errors for admin API