apolyakov added a comment. > bool handleSBError(SBError error, std::function<std::string(SBError)> > convert) { > if (error.Success()) > return false; > > SetError(convert(error)); > return error_handler(); > } > > ... > bool CMICmdCmdExecContinue::Execute() { > if > (handleSBError(CMICmnLLDBDebugSessionInfo::Instance().GetProcess().Continue(), > [](SBError error){ > return CMIUtilString::Format( > MIRSRC(IDS_CMD_ERR_SET_NEW_DRIVER_STATE), > this->m_cmdData.strMiCmd.c_str(), > rErrMsg.c_str());' > }) > return MIstatus::failure; > > // potentially run other SBAPI commands... > return MIstatus::success; > }; >
In this case, it's not clear how to pass `error_handler` to `handleSBError(...)`. Moreover, user may want to specify action for success case which isn't presented in your example. About using more than one SB API command: it's possible even in my patch, just use `ReturnMIStatus` like: if (!ReturnMIStatus(success_handler, error_handler, error)) return MIstatus::failure; // do other stuff ... return MIstatus::success; https://reviews.llvm.org/D48295 _______________________________________________ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits