Ignore:
Timestamp:
2016-06-14T18:50:32+02:00 (8 years ago)
Author:
Don-vip
Message:

fix #12945 - Better exception wrapping for runInEDTAndWaitWithException (patch by michael2402) - gsoc-core

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/gui/util/GuiHelper.java

    r10295 r10372  
    6262import org.openstreetmap.josm.tools.ImageProvider.ImageSizes;
    6363import org.openstreetmap.josm.tools.LanguageInfo;
     64import org.openstreetmap.josm.tools.bugreport.BugReport;
     65import org.openstreetmap.josm.tools.bugreport.ReportedException;
    6466
    6567/**
     
    135137     * <p>
    136138     * Passes on the exception that was thrown to the thread calling this.
    137      * The exception is wrapped in a {@link RuntimeException} if it was a normal {@link Throwable}.
     139     * The exception is wrapped using a {@link ReportedException}.
    138140     * @param task The runnable to execute
    139141     * @see SwingUtilities#invokeAndWait
     
    146148            try {
    147149                SwingUtilities.invokeAndWait(task);
    148             } catch (InterruptedException e) {
    149                 Main.error(e);
    150             } catch (InvocationTargetException e) {
    151                 if (e.getCause() instanceof RuntimeException) {
    152                     throw (RuntimeException) e.getCause();
    153                 } else {
    154                     throw new RuntimeException("Exception while calling " + task, e.getCause());
    155                 }
     150            } catch (InterruptedException | InvocationTargetException e) {
     151                throw BugReport.intercept(e).put("task", task);
    156152            }
    157153        }
Note: See TracChangeset for help on using the changeset viewer.