javascript scope test try-catch