Open wadechristie opened 1 year ago
It seems to me the problem is at line 113 with the decision to break out of the loop just before the error would have been returned: https://github.com/bfgroup/Lyra/blob/a8bb6e22ea4dcd507292ecdb6443bad23ef7bfeb/include/lyra/arguments.hpp#L313-L321
I encountered this problem when attempting to nest a lamba option under a sub-command. The error context returned from the lambda is dropped when unwinding the stack.
Here is an example to demonstrate the behavior:
Behavior with a top-level argument.
Behavior with a sub-command argument. The error message with context for the user is lost.
The error propagates back up the stack to this point: https://github.com/bfgroup/Lyra/blob/a8bb6e22ea4dcd507292ecdb6443bad23ef7bfeb/include/lyra/arguments.hpp#L313-L316
And the error context is dropped a few lines later here: https://github.com/bfgroup/Lyra/blob/a8bb6e22ea4dcd507292ecdb6443bad23ef7bfeb/include/lyra/arguments.hpp#L351-L352