Fix incorrect exception handling (was bug 837169)

Fallout from commit a140fb5a