[Lldb-commits] [PATCH] D129614: [lldb/crashlog] Surface error using SBCommandReturnObject argument
Jonas Devlieghere via Phabricator via lldb-commits
lldb-commits at lists.llvm.org
Tue Aug 2 09:05:00 PDT 2022
JDevlieghere added inline comments.
================
Comment at: lldb/examples/python/crashlog.py:1012-1015
+ def error(message, sb_error=lldb.SBError()):
+ nonlocal result
+ result.SetError(sb_error, "error: %s" % message)
+ return
----------------
mib wrote:
> JDevlieghere wrote:
> > Can we do this with a try-catch + an exception?
> @JDevlieghere As mentioned on D129611, if we raise an exception we won't be able to surface the error to lldb or even to IDEs. I think it's better to use the `SBCommandReturnObject`
>
> @kastiglione true! I'll remove the "error: " prefix, but I think it's reasonable to keep this helper function to avoid code duplication.
Couldn't you still raise the error where it happens and then catch it and then take it's value and put it into the SBCommandReturnObject?
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D129614/new/
https://reviews.llvm.org/D129614
More information about the lldb-commits
mailing list