If an exception occurs when opening a trace, the exception message
is displayed but the stack is nowhere to be found. By logging the
exception, the stack trace will be available in the log.
Change-Id: I8085cb46a1657747cc2f2be5736e4b17e0b7040f
Signed-off-by: Marc-Andre Laperle <marc-andre.laperle@ericsson.com>
Reviewed-on: https://git.eclipse.org/r/79792
Reviewed-by: Hudson CI
trace.initTrace(traceElement.getResource(), traceElement.getResource().getLocation().toOSString(), traceEvent.getClass(), traceElement.getElementPath(), traceElement.getTraceType());
} catch (final TmfTraceException e) {
TraceUtils.displayErrorMsg(NLS.bind(Messages.TmfOpenTraceHelper_OpenElement, traceElement.getTypeName()),
trace.initTrace(traceElement.getResource(), traceElement.getResource().getLocation().toOSString(), traceEvent.getClass(), traceElement.getElementPath(), traceElement.getTraceType());
} catch (final TmfTraceException e) {
TraceUtils.displayErrorMsg(NLS.bind(Messages.TmfOpenTraceHelper_OpenElement, traceElement.getTypeName()),
- Messages.TmfOpenTraceHelper_InitError + ENDL + ENDL + e);
+ Messages.TmfOpenTraceHelper_InitError + ENDL + ENDL + e, e);
trace.dispose();
return null;
}
trace.dispose();
return null;
}
* The error message to display
*/
public static void displayErrorMsg(final String boxTitle, final String errorMsg) {
* The error message to display
*/
public static void displayErrorMsg(final String boxTitle, final String errorMsg) {
+ displayErrorMsg(boxTitle, errorMsg, null);
+ }
+
+ /**
+ * Displays an error message in a box
+ *
+ * @param boxTitle
+ * The message box title
+ * @param errorMsg
+ * The error message to display
+ * @param exception
+ * the exception or null if the error does not originate from an
+ * exception
+ * @since 2.2
+ */
+ public static void displayErrorMsg(final String boxTitle, final String errorMsg, Throwable exception) {
Display.getDefault().asyncExec(new Runnable() {
@Override
public void run() {
final Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell();
Display.getDefault().asyncExec(new Runnable() {
@Override
public void run() {
final Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell();
- Activator.getDefault().logError(errorMsg);
+ Activator.getDefault().logError(errorMsg, exception);
MessageDialog.openError(shell, boxTitle, errorMsg);
}
});
MessageDialog.openError(shell, boxTitle, errorMsg);
}
});