Ignore:
Timestamp:
09.03.2010 14:00:46 (2 years ago)
Author:
Gubaer
Message:

fixed #4684: HTTP 408 gives coding error popup

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/tools/ExceptionUtil.java

    r3083 r3101  
    141141        ); 
    142142    } 
     143 
     144    /** 
     145     * Explains an OSM API exception because of a client timeout (HTTP 408). 
     146     *  
     147     * @param e the exception 
     148     * @return the message 
     149     */ 
     150    public static String explainClientTimeout(OsmApiException e) { 
     151        e.printStackTrace(); 
     152        return tr("<html>" 
     153                + "Communication with the OSM server ''{0}'' timed out. Please retry later." 
     154                + "</html>", 
     155                OsmApi.getOsmApi().getBaseUrl() 
     156        ); 
     157    } 
     158 
     159    /** 
     160     * Replies a generic error message for an OSM API exception 
     161     *  
     162     * @param e the exception 
     163     * @return the message 
     164     */ 
     165    public static String explainGenericOsmApiException(OsmApiException e) { 
     166        e.printStackTrace(); 
     167        String errMsg = e.getErrorHeader(); 
     168        if (errMsg == null) { 
     169            errMsg = e.getErrorBody(); 
     170        } 
     171        if (errMsg == null) { 
     172            errMsg = tr("no error message available"); 
     173        } 
     174        return tr("<html>" 
     175                + "Communication with the OSM server ''{0}''failed. The server replied<br>" 
     176                + "the following error code and the following error message:<br>" 
     177                + "<strong>Error code:<strong> {1}<br>" 
     178                + "<strong>Error message (untranslated)</strong>: {2}" 
     179                + "</html>", 
     180                OsmApi.getOsmApi().getBaseUrl(), 
     181                e.getResponseCode(), 
     182                errMsg 
     183        ); 
     184    } 
     185 
    143186    /** 
    144187     * Explains an error due to a 409 conflict 
Note: See TracChangeset for help on using the changeset viewer.