This question is close to others - Can I get the exit code from a sub shell launched with $(command)?
However there are no solutions I've found that allows me to get an exit code from a sub shell when using local and eval as in this example...
test() {
> local WHY="$(eval "echo 'test'"; exit 3)"; echo $?
> }
test
0
local why; why=$(false); echo $?;
(btw, don't use uppercase names for local variables).