[784] | 1 | // License: GPL. For details, see LICENSE file.
|
---|
| 2 | package org.openstreetmap.josm.io;
|
---|
| 3 |
|
---|
[5386] | 4 | /**
|
---|
| 5 | * Exception thrown when a communication error with the OSM server occurs.
|
---|
| 6 | */
|
---|
[784] | 7 | public class OsmTransferException extends Exception {
|
---|
| 8 |
|
---|
[3255] | 9 | private String url = OsmApi.getOsmApi().getBaseUrl();
|
---|
| 10 |
|
---|
[5386] | 11 | /**
|
---|
| 12 | * Constructs an {@code OsmTransferException} with {@code null} as its error detail message.
|
---|
| 13 | * The cause is not initialized, and may subsequently be initialized by a call to {@link #initCause}.
|
---|
| 14 | */
|
---|
[1169] | 15 | public OsmTransferException() {
|
---|
| 16 | }
|
---|
[784] | 17 |
|
---|
[5386] | 18 | /**
|
---|
| 19 | * Constructs an {@code OsmTransferException} with the specified detail message.
|
---|
| 20 | * The cause is not initialized, and may subsequently be initialized by a call to {@link #initCause}.
|
---|
| 21 | *
|
---|
| 22 | * @param message The detail message (which is saved for later retrieval by the {@link #getMessage} method)
|
---|
| 23 | */
|
---|
[1169] | 24 | public OsmTransferException(String message) {
|
---|
| 25 | super(message);
|
---|
| 26 | }
|
---|
[784] | 27 |
|
---|
[5386] | 28 | /**
|
---|
[6070] | 29 | * Constructs an {@code OsmTransferException} with the specified cause and a detail message of
|
---|
| 30 | * <tt>(cause==null ? null : cause.toString())</tt>
|
---|
[5386] | 31 | * (which typically contains the class and detail message of <tt>cause</tt>).
|
---|
| 32 | *
|
---|
[6070] | 33 | * @param cause the cause (which is saved for later retrieval by the {@link #getCause} method).
|
---|
[5386] | 34 | * A <tt>null</tt> value is permitted, and indicates that the cause is nonexistent or unknown.
|
---|
| 35 | */
|
---|
[1169] | 36 | public OsmTransferException(Throwable cause) {
|
---|
| 37 | super(cause);
|
---|
| 38 | }
|
---|
[784] | 39 |
|
---|
[5386] | 40 | /**
|
---|
| 41 | * Constructs an {@code OsmTransferException} with the specified detail message and cause.
|
---|
| 42 | *
|
---|
[6070] | 43 | * <p> Note that the detail message associated with {@code cause} is <i>not</i> automatically incorporated
|
---|
[5386] | 44 | * into this exception's detail message.
|
---|
| 45 | *
|
---|
| 46 | * @param message The detail message (which is saved for later retrieval by the {@link #getMessage} method)
|
---|
| 47 | * @param cause The cause (which is saved for later retrieval by the {@link #getCause} method).
|
---|
| 48 | * A null value is permitted, and indicates that the cause is nonexistent or unknown.
|
---|
| 49 | *
|
---|
| 50 | */
|
---|
[1169] | 51 | public OsmTransferException(String message, Throwable cause) {
|
---|
| 52 | super(message, cause);
|
---|
| 53 | }
|
---|
[784] | 54 |
|
---|
[5386] | 55 | /**
|
---|
| 56 | * Sets the URL related to this error.
|
---|
| 57 | * @param url the URL related to this error (which is saved for later retrieval by the {@link #getUrl} method).
|
---|
| 58 | */
|
---|
[3255] | 59 | public void setUrl(String url) {
|
---|
| 60 | this.url = url;
|
---|
| 61 | }
|
---|
| 62 |
|
---|
| 63 | /**
|
---|
[5386] | 64 | * Gets the URL related to this error.
|
---|
| 65 | * @return API base URL or URL set using the {@link #setUrl} method
|
---|
[3255] | 66 | */
|
---|
| 67 | public String getUrl() {
|
---|
| 68 | return url;
|
---|
| 69 | }
|
---|
[784] | 70 | }
|
---|