Combining JavaScript try, catch and throw: Example to Follow