1. John Paulett
  2. UploadAssistant

Commits

John Paulett  committed 1a5de89

Use JOptionPane to create error dialog when Dicom anon scripts fail.

Protects against when external webservice is down and GetURL fails.

Comments (0)

Files changed (1)

File src/main/java/org/nrg/dcm/DicomSessionVariable.java Modified

View file
  • Ignore whitespace
  • Hide word diff
 import java.util.Collections;
 import java.util.Set;
 
+import javax.swing.JOptionPane;
+
 import org.dcm4che2.data.DicomObject;
 import org.nrg.dcm.edit.MultipleInitializationException;
 import org.nrg.dcm.edit.ScriptEvaluationException;
 				try {
 					return iv.on(sample);
 				} catch (ScriptEvaluationException e) {
+					final StringBuilder errorMessage = new StringBuilder();
+					errorMessage.append("An serious error was encountered while preparing the DICOM.\n");
+					errorMessage.append("Please contact your site administrator with the following error\n");
+					errorMessage.append("message before uploading this data, as it could contain incorrect data.\n\n");
+					errorMessage.append(e.getMessage());
+					
+					//non-ideal, but somewhat protects against HTTP issues in GetURL
+					JOptionPane.showMessageDialog(null, errorMessage.toString(), "DICOM Script Error", JOptionPane.ERROR_MESSAGE);
+					
 					return null;
 				}
 			}