[API] Improve error management and description of returned error.