Search in sources :

Example 1 with ExceptionFault

use of flash.tools.debugger.events.ExceptionFault in project intellij-plugins by JetBrains.

the class DebugCLI method handleFault.

/**
	 * We have received a fault and are possibly suspended at this point.
	 * We need to look at our fault table and determine what do.
	 * @return true if we resumed execution
	 */
boolean handleFault(FaultEvent e) {
    // lookup what we need to do
    boolean requestResume = false;
    String name = e.name();
    boolean stop = true;
    boolean print = true;
    try {
        //$NON-NLS-1$
        print = m_faultTable.is(name, "print");
        //$NON-NLS-1$
        stop = m_faultTable.is(name, "stop");
    } catch (NullPointerException npe) {
        if (Trace.error) {
            Map<String, Object> args = new HashMap<String, Object>();
            //$NON-NLS-1$
            args.put("faultName", name);
            //$NON-NLS-1$
            Trace.trace(getLocalizationManager().getLocalizedTextString("faultHasNoTableEntry", args));
            npe.printStackTrace();
        }
    }
    if (e instanceof ExceptionFault) {
        ExceptionFault ef = (ExceptionFault) e;
        Value thrownValue = ef.getThrownValue();
        if (thrownValue != null) {
            if (!ef.willExceptionBeCaught()) {
                stop = true;
            } else {
                stop = false;
                String typeName = thrownValue.getTypeName();
                int at = typeName.indexOf('@');
                if (at != -1)
                    typeName = typeName.substring(0, at);
                for (int i = 0; i < catchpointCount(); ++i) {
                    CatchAction c = catchpointAt(i);
                    String typeToCatch = c.getTypeToCatch();
                    try {
                        if (typeToCatch == null || getSession().evalIs(thrownValue, typeToCatch)) {
                            stop = true;
                            break;
                        }
                    } catch (PlayerDebugException e1) {
                        // TODO Auto-generated catch block
                        e1.printStackTrace();
                        stop = true;
                    } catch (PlayerFaultException e1) {
                        // TODO Auto-generated catch block
                        e1.printStackTrace();
                        stop = true;
                    }
                }
                if (!stop)
                    print = false;
            }
        }
    }
    // should we stop?
    if (!stop)
        requestResume = true;
    if (print)
        dumpFaultLine(e);
    return requestResume;
}
Also used : ExceptionFault(flash.tools.debugger.events.ExceptionFault) Value(flash.tools.debugger.Value) PlayerFaultException(flash.tools.debugger.expression.PlayerFaultException) PlayerDebugException(flash.tools.debugger.PlayerDebugException) Map(java.util.Map) HashMap(java.util.HashMap)

Aggregations

PlayerDebugException (flash.tools.debugger.PlayerDebugException)1 Value (flash.tools.debugger.Value)1 ExceptionFault (flash.tools.debugger.events.ExceptionFault)1 PlayerFaultException (flash.tools.debugger.expression.PlayerFaultException)1 HashMap (java.util.HashMap)1 Map (java.util.Map)1