Improved error handling for download as csv