1 | // License: GPL. For details, see LICENSE file.
|
---|
2 | package org.openstreetmap.josm.io;
|
---|
3 |
|
---|
4 | /**
|
---|
5 | * Exception thrown when a communication error with the OSM server occurs.
|
---|
6 | */
|
---|
7 | public class OsmTransferException extends Exception {
|
---|
8 |
|
---|
9 | private String url = OsmApi.getOsmApi().getBaseUrl();
|
---|
10 |
|
---|
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 | */
|
---|
15 | public OsmTransferException() {
|
---|
16 | }
|
---|
17 |
|
---|
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 | */
|
---|
24 | public OsmTransferException(String message) {
|
---|
25 | super(message);
|
---|
26 | }
|
---|
27 |
|
---|
28 | /**
|
---|
29 | * Constructs an {@code OsmTransferException} with the specified cause and a detail message of
|
---|
30 | * <code>(cause==null ? null : cause.toString())</code>
|
---|
31 | * (which typically contains the class and detail message of <code>cause</code>).
|
---|
32 | *
|
---|
33 | * @param cause the cause (which is saved for later retrieval by the {@link #getCause} method).
|
---|
34 | * A <code>null</code> value is permitted, and indicates that the cause is nonexistent or unknown.
|
---|
35 | */
|
---|
36 | public OsmTransferException(Throwable cause) {
|
---|
37 | super(cause);
|
---|
38 | }
|
---|
39 |
|
---|
40 | /**
|
---|
41 | * Constructs an {@code OsmTransferException} with the specified detail message and cause.
|
---|
42 | *
|
---|
43 | * <p> Note that the detail message associated with {@code cause} is <i>not</i> automatically incorporated
|
---|
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 | */
|
---|
51 | public OsmTransferException(String message, Throwable cause) {
|
---|
52 | super(message, cause);
|
---|
53 | }
|
---|
54 |
|
---|
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 | */
|
---|
59 | public void setUrl(String url) {
|
---|
60 | this.url = url;
|
---|
61 | }
|
---|
62 |
|
---|
63 | /**
|
---|
64 | * Gets the URL related to this error.
|
---|
65 | * @return API base URL or URL set using the {@link #setUrl} method
|
---|
66 | */
|
---|
67 | public String getUrl() {
|
---|
68 | return url;
|
---|
69 | }
|
---|
70 | }
|
---|