Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'toolchains/arduino/org.eclipse.cdt.arduino.core/src/org/eclipse/cdt/arduino/core/internal/Activator.java')
-rw-r--r--toolchains/arduino/org.eclipse.cdt.arduino.core/src/org/eclipse/cdt/arduino/core/internal/Activator.java13
1 files changed, 13 insertions, 0 deletions
diff --git a/toolchains/arduino/org.eclipse.cdt.arduino.core/src/org/eclipse/cdt/arduino/core/internal/Activator.java b/toolchains/arduino/org.eclipse.cdt.arduino.core/src/org/eclipse/cdt/arduino/core/internal/Activator.java
index e34ed5e625d..85aaa0a2f49 100644
--- a/toolchains/arduino/org.eclipse.cdt.arduino.core/src/org/eclipse/cdt/arduino/core/internal/Activator.java
+++ b/toolchains/arduino/org.eclipse.cdt.arduino.core/src/org/eclipse/cdt/arduino/core/internal/Activator.java
@@ -59,4 +59,17 @@ public class Activator extends Plugin {
return ref != null ? context.getService(ref) : null;
}
+ public static CoreException coreException(Throwable e) {
+ if (e instanceof RuntimeException && e.getCause() instanceof CoreException) {
+ return (CoreException) e.getCause();
+ } else if (e instanceof CoreException) {
+ return (CoreException) e;
+ }
+ return new CoreException(new Status(IStatus.ERROR, getId(), e.getLocalizedMessage(), e));
+ }
+
+ public static CoreException coreException(String message, Throwable e) {
+ return new CoreException(new Status(IStatus.ERROR, getId(), message, e));
+ }
+
}

Back to the top