} catch (JsonProtocolParseException e) {
throw new RuntimeException(e);
}
InternalContext internalContext = getInternalContext();
ValueMirror mirror = internalContext.getValueLoader().addDataToMap(body);
JsValueBase value =
JsVariableBase.createValue(internalContext.getValueLoader(), mirror);
callback.success(value);
}
@Override
public void failure(String message, ErrorDetails errorDetails) {
// We are not fully correct here.
// All that we actually receive from the other side is a string message.
// It might be message of exception or it could be diagnostic of any other
// kind of error.
// We incorrectly create string value out of this message and return
// it as an exception.
// TODO: Return actual exception value when protocol supports it.
JsValueBase pseudoException = getValueFactory().createString(message);
callback.exception(pseudoException);
}
};
return getInternalContext().sendV8CommandAsync(message, true, commandCallback,