source: josm/trunk/src/org/openstreetmap/josm/plugins/PluginException.java@ 10708

Last change on this file since 10708 was 10050, checked in by Don-vip, 8 years ago

add more unit tests

  • Property svn:eol-style set to native
File size: 1.8 KB
Line 
1// License: GPL. For details, see LICENSE file.
2package org.openstreetmap.josm.plugins;
3
4import 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.. ;)
10 *
11 * @author Immanuel.Scholz
12 * @since 149
13 */
14public class PluginException extends Exception {
15
16 /** Plugin proxy, can be null */
17 public final transient PluginProxy plugin;
18
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 */
25 public PluginException(PluginProxy plugin, String name, Throwable cause) {
26 super(tr("An error occurred in plugin {0}", name), cause);
27 this.plugin = plugin;
28 }
29
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 */
34 public PluginException(String message) {
35 super(message);
36 this.plugin = null;
37 }
38
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 */
45 public PluginException(String name, Throwable cause) {
46 super(tr("An error occurred in plugin {0}", name), cause);
47 this.plugin = null;
48 }
49}
Note: See TracBrowser for help on using the repository browser.