Index: /trunk/src/org/openstreetmap/josm/actions/UploadAction.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/actions/UploadAction.java	(revision 1759)
+++ /trunk/src/org/openstreetmap/josm/actions/UploadAction.java	(revision 1760)
@@ -530,17 +530,33 @@
                 return;
             }
+            // any other API exception
+            //
+            else {
+                ex.printStackTrace();
+                String msg = tr("<html>Uploading <strong>failed</strong>."
+                        + "<br>"
+                        + "{0}"
+                        + "</html>",
+                        ex.getDisplayMessage()
+                );
+                JOptionPane.showMessageDialog(
+                        Main.map,
+                        msg,
+                        tr("Upload to OSM API failed"),
+                        JOptionPane.ERROR_MESSAGE
+                );
+                return;
+            }
         }
 
         // For any other exception just notify the user
         //
-        String msg;
-        if (e.getMessage() == null) {
+        String msg = e.getMessage();
+        if (msg == null) {
             msg = e.toString();
-        } else {
-            msg = e.getMessage();
         }
         e.printStackTrace();
         JOptionPane.showMessageDialog(
-                null,
+                Main.map,
                 msg,
                 tr("Upload to OSM API failed"),
Index: /trunk/src/org/openstreetmap/josm/io/OsmApiException.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/io/OsmApiException.java	(revision 1759)
+++ /trunk/src/org/openstreetmap/josm/io/OsmApiException.java	(revision 1760)
@@ -1,4 +1,5 @@
 // License: GPL. For details, see LICENSE file.
 package org.openstreetmap.josm.io;
+import static org.openstreetmap.josm.tools.I18n.tr;
 
 public class OsmApiException extends OsmTransferException {
@@ -65,5 +66,5 @@
         }
         if (errorBody != null) {
-            errorBody = errorBody.replaceAll("^[ \n\t\r]+", "").replaceAll("[ \n\t\r]+$", "");
+            errorBody = errorBody.trim();
             if(!errorBody.equals(errorHeader)) {
                 sb.append(", Error Body=<")
@@ -74,3 +75,23 @@
         return sb.toString();
     }
+
+    /**
+     * Replies a message suitable to be displayed in a message dialog
+     * 
+     * @return a message which is suitable to be displayed in a message dialog
+     */
+    public String getDisplayMessage() {
+        StringBuilder sb = new StringBuilder();
+        if (errorHeader != null) {
+            sb.append(tr(errorHeader));
+            sb.append(tr("(Code={0})", responseCode));
+        } else if (errorBody != null) {
+            errorBody = errorBody.trim();
+            sb.append(tr(errorBody));
+            sb.append(tr("(Code={0})", responseCode));
+        } else {
+            sb.append(tr("The server replied an error with code {0}", responseCode));
+        }
+        return sb.toString();
+    }
 }
