mirror of
https://github.com/eclipse-sailing-analytics/sailing-analytics.git
synced 2026-10-02 10:23:51 +00:00
improved error message in case of file upload
This commit is contained in:
1 parent
ccf217b015
commit
4f593b08d3
1 file changed
+3
-2
+3
-2
@@ -17,6 +17,7 @@ import org.apache.commons.fileupload.FileItem;
|
||||
import org.json.simple.JSONArray;
|
||||
import org.json.simple.JSONObject;
|
||||
|
||||
import com.sap.sse.common.NoCorrespondingServiceRegisteredException;
|
||||
import com.sap.sse.filestorage.InvalidPropertiesException;
|
||||
import com.sap.sse.filestorage.OperationFailedException;
|
||||
|
||||
@@ -66,8 +67,8 @@ public class FileUploadServlet extends AbstractFileUploadServlet {
|
||||
.storeFile(fileItem.getInputStream(), fileExtension, fileItem.getSize());
|
||||
result.put(JSON_FILE_NAME, fileItem.getName());
|
||||
result.put(JSON_FILE_URI, fileUri.toString());
|
||||
} catch (IOException | OperationFailedException | InvalidPropertiesException e) {
|
||||
final String errorMessage = "Could not store file: " + e.getMessage();
|
||||
} catch (IOException | OperationFailedException | InvalidPropertiesException | NoCorrespondingServiceRegisteredException e) {
|
||||
final String errorMessage = "Could not store file"+ (e.getMessage()==null?"":(": " + e.getMessage()));
|
||||
logger.log(Level.WARNING, "Could not store file", e);
|
||||
result.put("status", Status.INTERNAL_SERVER_ERROR.name());
|
||||
result.put("message", errorMessage);
|
||||
|
||||
Reference in new issue
Block a user