Commit 3f88ea02 authored by Marian Dovgialo's avatar Marian Dovgialo

#46038 When signal saving is finished with error svarog shows that error and time of occurence

parent 1fd62344
......@@ -46,15 +46,21 @@
* Shows a simple dialog with OK button showing the specified error message.
* @param message the error
*/
public static void showError(final String message) {
public static void showError(final String message) {
showError("Error", message);
}
public static void showError(final String title, final String message) {
SwingUtilities.invokeLater(new Runnable() {
@Override
public void run() {
Window dialogParent = SvarogApplication.getSharedInstance().getViewerElementManager().getDialogParent();
JOptionPane.showMessageDialog(dialogParent, message, _("Error"), JOptionPane.ERROR_MESSAGE);
JOptionPane.showMessageDialog(dialogParent, message, _(title), JOptionPane.ERROR_MESSAGE);
}
});
}
/**
* Shows a simple dialog showing the specified information message.
......
package org.signalml.app.worker.monitor.recording;
import java.text.SimpleDateFormat;
import java.util.Date;
import org.apache.log4j.Logger;
import org.signalml.app.view.common.dialogs.errors.Dialogs;
import org.signalml.app.worker.monitor.Helper;
import org.signalml.app.worker.monitor.exceptions.OpenbciCommunicationException;
import org.signalml.app.worker.monitor.messages.BaseMessage;
......@@ -49,6 +52,23 @@ public void run() {
} else if (response instanceof SavingSignalError) {
SavingSignalError error = (SavingSignalError) response;
logger.error("recording finished with error: " + error.details);
String error_text = "";
for (Object err_text: error.details.values())
{
try{
error_text += (String)err_text;
}
catch(ClassCastException e)
{
error_text += err_text.toString();
}
error_text += "\n";
}
error_text += "Signal preceeding this error message is not lost.\n";
String timeStamp = new SimpleDateFormat("yyyy.MM.dd HH:mm:ss").format(new Date());
error_text += "Error received at " + timeStamp;
Dialogs.showError("Signal saving error", error_text);
lastState = RecordingState.FINISHED;
} else {
logger.warn("received unexpected response while checking recording status");
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment