better error reporting on api