Code cleanup around exception handling and stack walking. am: 51ad7fe2ec

Change-Id: Ic929add93cb8e23f2ffc9f267b013e0730ab5067