How does try catch work in TypeScript?