[Lldb-commits] [PATCH] D48295: [WIP] Implement new ReturnMIStatus method of CMICmdBase class.

Alexander Polyakov via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Tue Jun 19 09:37:03 PDT 2018


apolyakov added a comment.

In https://reviews.llvm.org/D48295#1136663, @aprantl wrote:

> In this design the success_handlers return an exit status *and* set a string error. We could unify this by having the handler return an llvm::Error (https://llvm.org/doxygen/classllvm_1_1Error.html). When it is successful, it returns Error::success, otherwise it returns `llvm::make_error<llvm::StringError>("message", llvm::inconvertibleErrorCode)`. In ReturnMIStatus we do something like
>
>   auto status = handler(...)
>   bool exit_status =  MIstatus::success;
>   handleAllErrors(status.takeError(), [&](const StringError &error) {
>     his->SetError(error.getMessage();
>     exit_status =  error_handler();
>   });
>   return exit_status;
>


I don't completely understand what you mean. First of all, what do you mean when talking about success_handlers? 'cause if you mean success_handler from `Execute` function, then I should say that it doesn't have to set an error, it might be any. Secondly, `status` in your example is a function, how can it has a `takeError` method?


https://reviews.llvm.org/D48295





More information about the lldb-commits mailing list