Event event = Event.parseFrom(payload);
logger.finest("RECV EVENT: " + event.toString());
signalEvent(event);
break;
case 4: // error
Error error = Error.parseFrom(payload);
logger.finest("RECV ERROR: " + error.toString());
String service = error.getService();
int status = error.getStatus();
// We get exceptions when, in the ECMAScript services, we use a runtime that doesn't exist.
// We can ignore these exceptions and carry on.
if (((service.equals("ecmascript-debugger") || service.equals("ecmascript"))
&& status == Status.INTERNAL_ERROR.getNumber()) ||
(service.equals("ecmascript") && status == Status.BAD_REQUEST.getNumber()) ||
(service.equals("desktop-utils") && error.getCommandID() == DesktopUtilsMessage
.GET_STRING.getID())) {
signalResponse(error.getTag(), null);
} else {
connectionHandler.onException(
new CommunicationException(String.format("Error on command: %s", error)));
}