kopia lustrzana https://github.com/JOSM/MapWithAI
Fix #23971: Give a nicer error message when a server is down
Signed-off-by: Taylor Smock <tsmock@meta.com>pull/49/head v833
rodzic
817b633660
commit
629e34f413
|
@ -38,6 +38,7 @@ import org.openstreetmap.josm.gui.progress.ProgressMonitor;
|
||||||
import org.openstreetmap.josm.gui.progress.swing.PleaseWaitProgressMonitor;
|
import org.openstreetmap.josm.gui.progress.swing.PleaseWaitProgressMonitor;
|
||||||
import org.openstreetmap.josm.gui.util.GuiHelper;
|
import org.openstreetmap.josm.gui.util.GuiHelper;
|
||||||
import org.openstreetmap.josm.io.IllegalDataException;
|
import org.openstreetmap.josm.io.IllegalDataException;
|
||||||
|
import org.openstreetmap.josm.io.OsmApiException;
|
||||||
import org.openstreetmap.josm.io.OsmTransferException;
|
import org.openstreetmap.josm.io.OsmTransferException;
|
||||||
import org.openstreetmap.josm.plugins.mapwithai.MapWithAIPlugin;
|
import org.openstreetmap.josm.plugins.mapwithai.MapWithAIPlugin;
|
||||||
import org.openstreetmap.josm.plugins.mapwithai.commands.MapWithAIAddCommand;
|
import org.openstreetmap.josm.plugins.mapwithai.commands.MapWithAIAddCommand;
|
||||||
|
@ -198,9 +199,14 @@ public final class MapWithAIDataUtils {
|
||||||
original.mergeFrom(ds.join());
|
original.mergeFrom(ds.join());
|
||||||
} catch (RuntimeException e) {
|
} catch (RuntimeException e) {
|
||||||
final String notificationMessage;
|
final String notificationMessage;
|
||||||
final var cause = e.getCause();
|
Throwable cause = e.getCause();
|
||||||
if (cause instanceof IllegalDataException illegalDataException) {
|
if (cause != null) {
|
||||||
notificationMessage = ExceptionUtil.explainException(illegalDataException);
|
while (cause.getCause() != null && RuntimeException.class.equals(cause.getClass())) {
|
||||||
|
cause = cause.getCause();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (cause instanceof IllegalDataException) {
|
||||||
|
notificationMessage = ExceptionUtil.explainException((Exception) cause);
|
||||||
Logging.trace(e);
|
Logging.trace(e);
|
||||||
final var notification = new Notification();
|
final var notification = new Notification();
|
||||||
GuiHelper.runInEDT(() -> notification.setContent(notificationMessage));
|
GuiHelper.runInEDT(() -> notification.setContent(notificationMessage));
|
||||||
|
|
Ładowanie…
Reference in New Issue