[6380] | 1 | // License: GPL. For details, see LICENSE file.
|
---|
[626] | 2 | package org.openstreetmap.josm.plugins;
|
---|
| 3 |
|
---|
| 4 | import static org.openstreetmap.josm.tools.I18n.tr;
|
---|
| 5 |
|
---|
| 6 | /**
|
---|
| 7 | * Exception that wraps any exception thrown by plugins. It is used in the JOSM main system
|
---|
| 8 | * and there is no particular reason to use this within the plugin itself (although there
|
---|
| 9 | * is also no reason against this.. ;)
|
---|
[1169] | 10 | *
|
---|
[626] | 11 | * @author Immanuel.Scholz
|
---|
[10050] | 12 | * @since 149
|
---|
[626] | 13 | */
|
---|
[2817] | 14 | public class PluginException extends Exception {
|
---|
[10050] | 15 |
|
---|
| 16 | /** Plugin proxy, can be null */
|
---|
[8308] | 17 | public final transient PluginProxy plugin;
|
---|
[626] | 18 |
|
---|
[10050] | 19 | /**
|
---|
| 20 | * Constructs a new {@code PluginException} with the specified plugin and cause.
|
---|
| 21 | * @param plugin plugin proxy
|
---|
| 22 | * @param name plugin name
|
---|
| 23 | * @param cause cause the cause (which is saved for later retrieval by the {@link #getCause()} method).
|
---|
| 24 | */
|
---|
[1169] | 25 | public PluginException(PluginProxy plugin, String name, Throwable cause) {
|
---|
[1189] | 26 | super(tr("An error occurred in plugin {0}", name), cause);
|
---|
[1169] | 27 | this.plugin = plugin;
|
---|
[626] | 28 | }
|
---|
[2817] | 29 |
|
---|
[10050] | 30 | /**
|
---|
| 31 | * Constructs a new {@code PluginException} with the specified detail message.
|
---|
| 32 | * @param message message the detail message (which is saved for later retrieval by the {@link #getMessage()} method).
|
---|
| 33 | */
|
---|
[9983] | 34 | public PluginException(String message) {
|
---|
[2817] | 35 | super(message);
|
---|
| 36 | this.plugin = null;
|
---|
| 37 | }
|
---|
| 38 |
|
---|
[10050] | 39 | /**
|
---|
| 40 | * Constructs a new {@code PluginException} with the specified plugin name, cause and a detail message of
|
---|
| 41 | * <tt>(cause==null ? null : cause.toString())</tt> (which typically contains the class and detail message of <tt>cause</tt>).
|
---|
| 42 | * @param name plugin name
|
---|
| 43 | * @param cause cause the cause (which is saved for later retrieval by the {@link #getCause()} method).
|
---|
| 44 | */
|
---|
[2817] | 45 | public PluginException(String name, Throwable cause) {
|
---|
| 46 | super(tr("An error occurred in plugin {0}", name), cause);
|
---|
| 47 | this.plugin = null;
|
---|
| 48 | }
|
---|
[2512] | 49 | }
|
---|