test-both: throw exception; modify after leave