Why use Foundry's custom error type functionality in TypeScript?

Hi all,

I was looking at the documentation on TypeScript, and I noted that Foundry has a custom way of defining and catching custom errors (https://www.palantir.com/docs/foundry/functions/typescript-error-types/)

May I ask how this differs from doing it in native Typescript (i.e. extending an Error class and using try-catch statements), and the benefit of using Foundry’s version of it?

Thanks!