bit better error reporting on API calls