-
-
Notifications
You must be signed in to change notification settings - Fork 489
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update file upload so that it has better error support. (#8427)
- Add bilingual error message. - Fix queue removal so that it only remove items that are complete instead of fully clearing the queue. - Fix error message Uncaught TypeError: Cannot read properties of undefined (reading 'message') - Catch status 0 which is generally a network error and display an error message - Catch status 413 which may come from a proxy server with no messages - it now displays correct error message. - Add humanizeFileSize so that users can see errors in nice format instead of long byte format.
- Loading branch information
Showing
9 changed files
with
198 additions
and
13 deletions.
There are no files selected for viewing
81 changes: 81 additions & 0 deletions
81
core/src/main/java/org/fao/geonet/api/exception/GeonetMaxUploadSizeExceededException.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
/* | ||
* Copyright (C) 2001-2024 Food and Agriculture Organization of the | ||
* United Nations (FAO-UN), United Nations World Food Programme (WFP) | ||
* and United Nations Environment Programme (UNEP) | ||
* | ||
* This program is free software; you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
* the Free Software Foundation; either version 2 of the License, or (at | ||
* your option) any later version. | ||
* | ||
* This program is distributed in the hope that it will be useful, but | ||
* WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
* General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU General Public License | ||
* along with this program; if not, write to the Free Software | ||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA | ||
* | ||
* Contact: Jeroen Ticheler - FAO - Viale delle Terme di Caracalla 2, | ||
* Rome - Italy. email: [email protected] | ||
*/ | ||
|
||
package org.fao.geonet.api.exception; | ||
|
||
import java.util.Locale; | ||
|
||
import org.fao.geonet.exceptions.LocalizedException; | ||
|
||
public class GeonetMaxUploadSizeExceededException extends LocalizedException { | ||
|
||
public GeonetMaxUploadSizeExceededException() { | ||
super(); | ||
} | ||
|
||
public GeonetMaxUploadSizeExceededException(String message) { | ||
super(message); | ||
} | ||
|
||
public GeonetMaxUploadSizeExceededException(String message, Throwable cause) { | ||
super(message, cause); | ||
} | ||
|
||
public GeonetMaxUploadSizeExceededException(Throwable cause) { | ||
super(cause); | ||
} | ||
|
||
protected String getResourceBundleBeanQualifier() { | ||
return "apiMessages"; | ||
} | ||
|
||
@Override | ||
public GeonetMaxUploadSizeExceededException withMessageKey(String messageKey) { | ||
super.withMessageKey(messageKey); | ||
return this; | ||
} | ||
|
||
@Override | ||
public GeonetMaxUploadSizeExceededException withMessageKey(String messageKey, Object[] messageKeyArgs) { | ||
super.withMessageKey(messageKey, messageKeyArgs); | ||
return this; | ||
} | ||
|
||
@Override | ||
public GeonetMaxUploadSizeExceededException withDescriptionKey(String descriptionKey) { | ||
super.withDescriptionKey(descriptionKey); | ||
return this; | ||
} | ||
|
||
@Override | ||
public GeonetMaxUploadSizeExceededException withDescriptionKey(String descriptionKey, Object[] descriptionKeyArgs) { | ||
super.withDescriptionKey(descriptionKey, descriptionKeyArgs); | ||
return this; | ||
} | ||
|
||
@Override | ||
public GeonetMaxUploadSizeExceededException withLocale(Locale locale) { | ||
super.withLocale(locale); | ||
return this; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters