Can I create an error in typescript that cannot be caught?

52 Views Asked by At

I would like to assert, with an exception that cannot be caught. something like an internal type. the purpose is to stop execution at that point in the code (fail quickly when debugging), instead of getting caught in the calling side.

In dot net, MS implemented for that purpose an internal exception for code contracts, that cannot be caught. Any other solution could work for me too.

I am new to javascript and typescript. if there is an idiomatic way to do that please let me know.

1

There are 1 best solutions below

0
On

To "stop execution at that point in the code", You can use the keyword debugger.

This will pause the execution of the code, and you can then debug using your browser's inspector.