Simplify exception handling.

Fixes Coverity warning.
Fix missing break in product id determination.

Found by Coverity.