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.

  • Participants
  • Parent commits 9449408

Comments (0)

Files changed (1)

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

 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;
 				}
 			}