js snippet for try, catch, finally