Changeset 2075 in josm


Ignore:
Timestamp:
2009-09-07T00:14:47+02:00 (15 years ago)
Author:
Gubaer
Message:

fixed #3418: JOSM spews gzip content in 400 error message from server

File:
1 edited

Legend:

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

    r2035 r2075  
    212212                message,
    213213                tr("Internal Server Error"),
     214                JOptionPane.ERROR_MESSAGE
     215        );
     216    }
     217
     218    /**
     219     * Explains a {@see OsmApiException} which was thrown because of a bad
     220     * request
     221     *
     222     * @param e the exception
     223     */
     224    public static void explainBadRequest(OsmApiException e) {
     225        String apiUrl = OsmApi.getOsmApi().getBaseUrl();
     226        String message = tr("The OSM server ''{0}'' reported a bad request.<br>",
     227                apiUrl
     228        );
     229        if (e.getErrorHeader() != null && e.getErrorHeader().startsWith("The maximum bbox")) {
     230            message += "<br>" + tr("The area you tried to download is too big or your request was too large."
     231                    + "<br>Either request a smaller area or use an export file provided by the OSM community.");
     232        } else if (e.getErrorHeader() != null){
     233            message += tr("<br>Error message(untranslated): {0}", e.getErrorHeader());
     234        }
     235        message = "<html>" + message + "</html>";
     236        e.printStackTrace();
     237        JOptionPane.showMessageDialog(
     238                Main.parent,
     239                message,
     240                tr("Bad Request"),
    214241                JOptionPane.ERROR_MESSAGE
    215242        );
     
    315342                return;
    316343            }
     344            if (oae.getResponseCode() == HttpURLConnection.HTTP_BAD_REQUEST) {
     345                explainBadRequest(oae);
     346                return;
     347            }
    317348        }
    318349        explainGeneric(e);
Note: See TracChangeset for help on using the changeset viewer.