Revert "Revert "Minor rewrite to avoid multiple catch blocks in one statement (JS no likey)"" ;-)

This reverts commit ec86ff8db9c5b183318f8ef463e38e727b706cc0.

Signed-off-by: Erik de Bruin <erik@ixsoftware.nl>