Index: trunk/src/org/openstreetmap/josm/gui/ExceptionDialogUtil.java
===================================================================
--- trunk/src/org/openstreetmap/josm/gui/ExceptionDialogUtil.java	(revision 13498)
+++ trunk/src/org/openstreetmap/josm/gui/ExceptionDialogUtil.java	(revision 13499)
@@ -17,4 +17,5 @@
 import org.openstreetmap.josm.Main;
 import org.openstreetmap.josm.data.osm.OsmPrimitive;
+import org.openstreetmap.josm.gui.widgets.HtmlPanel;
 import org.openstreetmap.josm.io.ChangesetClosedException;
 import org.openstreetmap.josm.io.IllegalDataException;
@@ -361,7 +362,14 @@
      */
     public static void explainGenericHttpException(OsmApiException e) {
-        HelpAwareOptionPane.showOptionDialog(
-                Main.parent,
-                ExceptionUtil.explainGeneric(e),
+        String body = e.getErrorBody();
+        Object msg = null;
+        if ("text/html".equals(e.getContentType()) && body != null && body.startsWith("<") && body.contains("<html>")) {
+            msg = new HtmlPanel(body);
+        } else {
+            msg = ExceptionUtil.explainGeneric(e);
+        }
+        HelpAwareOptionPane.showOptionDialog(
+                Main.parent,
+                msg,
                 tr("Communication with OSM server failed"),
                 JOptionPane.ERROR_MESSAGE,
Index: trunk/src/org/openstreetmap/josm/io/OsmApi.java
===================================================================
--- trunk/src/org/openstreetmap/josm/io/OsmApi.java	(revision 13498)
+++ trunk/src/org/openstreetmap/josm/io/OsmApi.java	(revision 13499)
@@ -727,5 +727,5 @@
                     CredentialsManager.getInstance().purgeCredentialsCache(RequestorType.SERVER);
                     throw new OsmApiException(retCode, errorHeader, errorBody, activeConnection.getURL().toString(),
-                            doAuthenticate ? retrieveBasicAuthorizationLogin(client) : null);
+                            doAuthenticate ? retrieveBasicAuthorizationLogin(client) : null, response.getContentType());
                 default:
                     throw new OsmApiException(retCode, errorHeader, errorBody);
Index: trunk/src/org/openstreetmap/josm/io/OsmApiException.java
===================================================================
--- trunk/src/org/openstreetmap/josm/io/OsmApiException.java	(revision 13498)
+++ trunk/src/org/openstreetmap/josm/io/OsmApiException.java	(revision 13499)
@@ -12,4 +12,5 @@
 
     private int responseCode;
+    private String contentType;
     private String errorHeader;
     private String errorBody;
@@ -25,7 +26,8 @@
      * @param accessedUrl The complete URL accessed when this error occured
      * @param login the login used to connect to OSM API (can be null)
-     * @since 12992
-     */
-    public OsmApiException(int responseCode, String errorHeader, String errorBody, String accessedUrl, String login) {
+     * @param contentType the response content-type
+     * @since 13499
+     */
+    public OsmApiException(int responseCode, String errorHeader, String errorBody, String accessedUrl, String login, String contentType) {
         this.responseCode = responseCode;
         this.errorHeader = errorHeader;
@@ -33,4 +35,19 @@
         this.accessedUrl = accessedUrl;
         this.login = login;
+        this.contentType = contentType;
+    }
+
+    /**
+     * Constructs an {@code OsmApiException} with the specified response code, error header and error body
+     * @param responseCode The HTTP response code replied by the OSM server.
+     * See {@link java.net.HttpURLConnection HttpURLConnection} for predefined HTTP response code values
+     * @param errorHeader The error header, as transmitted in the {@code Error} field of the HTTP response header
+     * @param errorBody The error body, as transmitted in the HTTP response body
+     * @param accessedUrl The complete URL accessed when this error occured
+     * @param login the login used to connect to OSM API (can be null)
+     * @since 12992
+     */
+    public OsmApiException(int responseCode, String errorHeader, String errorBody, String accessedUrl, String login) {
+        this(responseCode, errorHeader, errorBody, accessedUrl, login, null);
     }
 
@@ -233,3 +250,21 @@
         return login;
     }
+
+    /**
+     * Sets the response content-type.
+     * @param contentType the response content-type.
+     * @since 13499
+     */
+    public final void setContentType(String contentType) {
+        this.contentType = contentType;
+    }
+
+    /**
+     * Replies the response content-type.
+     * @return the response content-type
+     * @since 13499
+     */
+    public final String getContentType() {
+        return contentType;
+    }
 }
Index: trunk/src/org/openstreetmap/josm/io/OsmServerReader.java
===================================================================
--- trunk/src/org/openstreetmap/josm/io/OsmServerReader.java	(revision 13498)
+++ trunk/src/org/openstreetmap/josm/io/OsmServerReader.java	(revision 13499)
@@ -208,5 +208,6 @@
                     String errorHeader = response.getHeaderField("Error");
                     String errorBody = fetchResponseText(response);
-                    throw new OsmApiException(response.getResponseCode(), errorHeader, errorBody, url.toString());
+                    throw new OsmApiException(response.getResponseCode(), errorHeader, errorBody, url.toString(), null,
+                            response.getContentType());
                 }
 
