Using a function in an if condition when set -e is set doesn't seem to break out or return false which means the workaround from 41ca8612 never gets triggered.