Improve exception handing during variable capture.
Improve exception handing during variable capture.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=187687825

GoogleCloudPlatform/cloud-debug-python,GoogleCloudPlatform/cloud-debug-python,GoogleCloudPlatform/cloud-debug-python