I’m using TypeScript for a reasonably large project, and am wondering what the standard is for the use of Errors. For example, say I hand an index out of bounds exception in Java:

throw new IndexOutOfBoundsException();

Would the equivalent statement in TypeScript be:

throw new Error("Index Out of Bounds");

What other ways could I accomplish this? What is the accepted standard?

4 Answers
4

Leave a Reply

Your email address will not be published. Required fields are marked *