altosui: Deal with serial port exceptions a bit better
[fw/altos] / altosui / AltosFlashUI.java
index 39151641e42bdbaa6bf1ef0bf93d269f8c1d9dfe..704ce35c9fca4227a830c60dd3a51525e0409ec8 100644 (file)
@@ -247,7 +247,7 @@ public class AltosFlashUI
                                        flash.set_romconfig(ui.rom_config);
                                        flash.flash();
                                }
-                       } catch (Exception ee) {
+                       } catch (InterruptedException ee) {
                                final Exception e = ee;
                                System.out.printf("exception %s\n", e.toString());
                                SwingUtilities.invokeLater(new Runnable() {
@@ -255,9 +255,26 @@ public class AltosFlashUI
                                                        ui.exception(e);
                                                }
                                        });
+                       } catch (IOException ee) {
+                               final Exception e = ee;
+                               System.out.printf("exception %s\n", e.toString());
+                               SwingUtilities.invokeLater(new Runnable() {
+                                               public void run() {
+                                                       ui.exception(e);
+                                               }
+                                       });
+                       } catch (AltosSerialInUseException ee) {
+                               final Exception e = ee;
+                               System.out.printf("exception %s\n", e.toString());
+                               SwingUtilities.invokeLater(new Runnable() {
+                                               public void run() {
+                                                       ui.exception(e);
+                                               }
+                                       });
+                       } finally {
+                               if (flash != null)
+                                       flash.close();
                        }
-                       if (flash != null)
-                               flash.close();
                }
 
                public flash_task(AltosFlashUI in_ui) {