jiakuan / gwt-uploader

An API to enable sophisticated file upload capabilities within a GWT application.
http://gwt-uploader.appspot.com/
Apache License 2.0
10 stars 6 forks source link

Access server error description #5

Closed mmalhado closed 4 years ago

mmalhado commented 5 years ago

I'm implementing a service that processes a CSV file and in case an error occurs during processing/validation a description in returned through the body of the HTTP response.

Currently, I don't think there is way to access this description on the client side so it can be presented to the user.

It seems to me it would make sense for the org.wisepersist.gwt.uploader.client.events.UploadErrorEvent#getMessage method (or an alternative to it) to return this data,

jiakuan commented 5 years ago

It seems we can improve the line 2330 of Uploader.java:

        uploadErrorEventCallback(file, UploadErrorEvent.ErrorCode.HTTP_ERROR.toInt(),
                                 "Unsuccessful server response code of: " + responseReceived);

by including serverData as the error message instead.

Could you please try that and see if it works? Any pull requests are welcome and appreciated.