Search in sources :

Example 1 with PlayerFaultException

use of flash.tools.debugger.expression.PlayerFaultException in project intellij-plugins by JetBrains.

the class DebugCLI method processDisplay.

// iterate through our display list entries
void processDisplay(StringBuffer sb) {
    int count = displayCount();
    for (int i = 0; i < count; i++) {
        DisplayAction a = displayAt(i);
        if (a.isEnabled()) {
            try {
                sb.append(a.getId());
                //$NON-NLS-1$
                sb.append(": ");
                sb.append(a.getContent());
                //$NON-NLS-1$
                sb.append(" = ");
                // command[0] contains our expression, so first we parse it, evalulate it then print it
                Object result = m_exprCache.evaluate(a.getExpression());
                if (result instanceof Variable)
                    ExpressionCache.appendVariableValue(sb, ((Variable) result).getValue());
                else if (result instanceof Value)
                    ExpressionCache.appendVariableValue(sb, (Value) result);
                else if (result instanceof InternalProperty)
                    sb.append(((InternalProperty) result).valueOf());
                else
                    sb.append(result);
                sb.append(m_newline);
            } catch (NoSuchVariableException nsv) {
                Map args = new HashMap();
                //$NON-NLS-1$
                args.put("variable", nsv.getMessage());
                //$NON-NLS-1$
                sb.append(getLocalizationManager().getLocalizedTextString("variableUnknown", args));
                sb.append(m_newline);
            } catch (NumberFormatException nfe) {
                Map args = new HashMap();
                //$NON-NLS-1$
                args.put("value", nfe.getMessage());
                //$NON-NLS-1$
                sb.append(getLocalizationManager().getLocalizedTextString("couldNotConvertToNumber", args));
                sb.append(m_newline);
            } catch (PlayerFaultException pfe) {
                sb.append(pfe.getMessage() + m_newline);
            } catch (NullPointerException npe) {
                //$NON-NLS-1$
                sb.append(getLocalizationManager().getLocalizedTextString("couldNotEvaluate"));
            }
        }
    }
}
Also used : Variable(flash.tools.debugger.Variable) NoSuchVariableException(flash.tools.debugger.expression.NoSuchVariableException) HashMap(java.util.HashMap) Value(flash.tools.debugger.Value) PlayerFaultException(flash.tools.debugger.expression.PlayerFaultException) Map(java.util.Map) HashMap(java.util.HashMap)

Example 2 with PlayerFaultException

use of flash.tools.debugger.expression.PlayerFaultException 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

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