001// License: GPL. For details, see LICENSE file. 002package org.openstreetmap.josm.tools.bugreport; 003 004/** 005 * An exception handler that asks the user to send a bug report. 006 * 007 * @author imi 008 * @since 40 009 */ 010public final class BugReportExceptionHandler implements Thread.UncaughtExceptionHandler { 011 012 @Override 013 public void uncaughtException(Thread t, Throwable e) { 014 handleException(e); 015 } 016 017 /** 018 * Handles the given exception 019 * @param e the exception 020 */ 021 public static synchronized void handleException(final Throwable e) { 022 BugReport.intercept(e).warn(); 023 } 024 025 /** 026 * Determines if an exception is currently being handled 027 * @return {@code true} if an exception is currently being handled, {@code false} otherwise 028 */ 029 public static boolean exceptionHandlingInProgress() { 030 return BugReportQueue.getInstance().exceptionHandlingInProgress(); 031 } 032}