Ignore:
Timestamp:
2018-03-04T16:09:51+01:00 (6 years ago)
Author:
Don-vip
Message:

fix #16050 - nicer display of HTTP errors from OSM API

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/gui/ExceptionDialogUtil.java

    r12620 r13499  
    1717import org.openstreetmap.josm.Main;
    1818import org.openstreetmap.josm.data.osm.OsmPrimitive;
     19import org.openstreetmap.josm.gui.widgets.HtmlPanel;
    1920import org.openstreetmap.josm.io.ChangesetClosedException;
    2021import org.openstreetmap.josm.io.IllegalDataException;
     
    361362     */
    362363    public static void explainGenericHttpException(OsmApiException e) {
    363         HelpAwareOptionPane.showOptionDialog(
    364                 Main.parent,
    365                 ExceptionUtil.explainGeneric(e),
     364        String body = e.getErrorBody();
     365        Object msg = null;
     366        if ("text/html".equals(e.getContentType()) && body != null && body.startsWith("<") && body.contains("<html>")) {
     367            msg = new HtmlPanel(body);
     368        } else {
     369            msg = ExceptionUtil.explainGeneric(e);
     370        }
     371        HelpAwareOptionPane.showOptionDialog(
     372                Main.parent,
     373                msg,
    366374                tr("Communication with OSM server failed"),
    367375                JOptionPane.ERROR_MESSAGE,
Note: See TracChangeset for help on using the changeset viewer.