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"));
}
}
}
}
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;
}
Aggregations