Example #1
0
bool CmdException::onClient(DebuggerClient *client) {
  if (DebuggerCommand::onClient(client)) return true;
  if (client->argCount() == 0) {
    return help(client);
  }

  bool regex = false;
  BreakPointInfo::State state = BreakPointInfo::Always;

  int index = 1;
  if (client->arg(1, "regex")) {
    regex = true;
    index++;
  } else if (client->arg(1, "once")) {
    state = BreakPointInfo::Once;
    index++;
  }

  BreakPointInfoPtr bpi(new BreakPointInfo(regex, state, ExceptionThrown,
                                           client->argValue(index), ""));
  if (!validate(client, bpi, index)) {
    client->tutorial(
      "This is the order of different arguments:\n"
      "\n"
      "\t[e]xception [r]egex|[o]nce {exp} if|&& {php}\n"
      "\n"
      "These are the components in an exception {exp}:\n"
      "\n"
      "\t{namespace}::{cls}@{url}"
      "\n"
    );
  }
  return true;
}
void CmdException::onClientImpl(DebuggerClient &client) {
  if (DebuggerCommand::displayedHelp(client)) return;
  if (client.argCount() == 0) {
    help(client);
    return;
  }

  bool regex = false;
  BreakPointInfo::State state = BreakPointInfo::Always;

  int index = 1;
  if (client.arg(1, "regex")) {
    regex = true;
    index++;
  } else if (client.arg(1, "once")) {
    state = BreakPointInfo::Once;
    index++;
  }

  BreakPointInfoPtr bpi(new BreakPointInfo(regex, state, ExceptionThrown,
                                           client.argValue(index), ""));
  if (!addToBreakpointListAndUpdateServer(client, bpi, index)) {
    client.tutorial(
      "This is the order of different arguments:\n"
      "\n"
      "\t[e]xception [r]egex|[o]nce {exp} if|&& {php}\n"
      "\n"
      "These are the components in an exception {exp}:\n"
      "\n"
      "\terror@{url}"
      "\t{namespace}::{cls}@{url}"
      "\n"
    );
  }
}