In strict TypeScript, the error caught in catch (err) has type unknown (because JavaScript lets you throw anything, not just Error objects). Always check err instanceof Error before reading err.message.
ADVERTISEMENT
We use cookies to collect and analyse information on site performance and usage, and to enhance and customise content and advertisements. Learn more
Required for basic website functionality.
Help us understand how visitors interact with the site.
Used to show relevant ads and measure ad performance.