Proper use of errors

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 … Read more

Why not use exceptions as regular flow of control?

To avoid all standard-answers I could have Googled on, I will provide an example you all can attack at will. C# and Java (and too many others) have with plenty of types some of ‘overflow’ behaviour I don’t like at all (e.g type.MaxValue + type.SmallestValue == type.MinValue for example : int.MaxValue + 1 == int.MinValue). … Read more

When to throw an exception?

I have exceptions created for every condition that my application does not expect. UserNameNotValidException, PasswordNotCorrectException etc. However I was told I should not create exceptions for those conditions. In my UML those ARE exceptions to the main flow, so why should it not be an exception? Any guidance or best practices for creating exceptions? 32 … Read more

Dealing with “java.lang.OutOfMemoryError: PermGen space” error

Recently I ran into this error in my web application: java.lang.OutOfMemoryError: PermGen space It’s a typical Hibernate/JPA + IceFaces/JSF application running on Tomcat 6 and JDK 1.6. Apparently this can occur after redeploying an application a few times. What causes it and what can be done to avoid it? How do I fix the problem? … Read more