You searched for exceptions. We found 702 results in 0.119 seconds.

list of exceptions

I am looking for a list of possible exceptions in c#, c++, vb.net, j# and jscript. The problem is that some sites show me a list of 20 exceptions whereas some other site shows me...
Jon Skeet
people
quotationmark

There are loads of exceptions declared by the .NET framework - and other code (including your own) can create more. There are certainly more than 39.... look at the documentation for System.Exception and you'll see near the bottom a list... more

people

Can constructors throw exceptions in Java?

Are constructors allowed to throw exceptions?
Jon Skeet
people
quotationmark

Yes, constructors can throw exceptions. Usually this means that the new object is immediately eligible for garbage collection (although it may not be collected for some time, of course). It's possible for the "half-constructed" object to... more

people

How slow are .NET exceptions?

I don't want a discussion about when to and not to throw exceptions. I wish to resolve a simple issue. 99% of the time the argument for not throwing exceptions revolves around...
Jon Skeet
people
quotationmark

I'm on the "not slow" side. I've written two short articles about this. There are criticisms of the benchmark aspect, which are mostly down to "in real life there'd be more stack to go through, so you'd blow the cache etc" - but using... more

people

How to work with unchecked exceptions?

Java has compiler checked exceptions. When I made transition to C++, I learned it doesn't feature checked exceptions. At first, I kept using exception handling, because it's a...
Jon Skeet
people
quotationmark

When I first started using C# I was scared by this too. Then I found that actually, it doesn't matter very often. I very rarely find that I can catch an exception and so something useful with it anyway... almost all my exceptions bubble up... more

people

Errors and Exceptions

I am using JDK1.6_14. This is a generic question though. When to go for error handling and when to go for exception handling? For example, when I carry a division operation out,...
Jon Skeet
people
quotationmark

In general, avoid provoking an exception which you could easily have avoided by execution-time testing and which could be a problem for reasons other than a bug elsewhere in your code. If you're going to divide by something and you have... more

people

Catching exceptions in Java

There are certain predefined exceptions in Java, which, if thrown, report that something serious has happened and you'd better improve your code, than catching them in a catch...
Jon Skeet
people
quotationmark

No, there's nothing wrong with catching IOException and FileNotFoundException - if you can genuinely handle those exceptions. That's the important bit - can you really proceed in the face of that exception? Sometimes you can - very often... more

people

Custom RunTime Exceptions

So this is regarding an interview question I was recently asked. The interviewer started on this by asking me how we create our custom Exceptions. On answering that, he asked me...
Jon Skeet
people
quotationmark

You would create your own RuntimeException subclass if: You don't want it to be a checked exception, because you don't expect callers to explicitly catch the exception. (Personally I believe that checked exceptions are rather overused in... more

people

Is it possible to handle exceptions within LINQ queries?

Example: myEnumerable.Select(a => ThisMethodMayThrowExceptions(a)); How to make it work even if it throws exceptions? Like a try catch block with a default value case an...
Jon Skeet
people
quotationmark

Call a projection which has that try/catch: myEnumerable.Select(a => TryThisMethod(a)); ... public static Bar TryThisMethod(Foo a) { try { return ThisMethodMayThrowExceptions(a); } ... more

people

Example of chained exceptions stack

I do not know much about these technologies, and was not very successful at finding how an exception stack is displayed. Therefore, several basic questions: how are 2...
Jon Skeet
people
quotationmark

It's pretty easy to try this for yourself. For example: using System; class Test { static void Main(string[] args) { try { Top(); } catch (Exception e) { ... more

people

On Asserts and Exceptions; Java

In this specific scenarios, are asserts more appropriate then exceptions? It is my understanding that assert should be used when program is FUBAR to a degree where it can not...
Jon Skeet
people
quotationmark

Personally I'm not keen on using assertions for this sort of thing, simply because they can be turned off. Some places use assertions when running tests, but then disable them for production for the sake of speed. To me this is like taking... more

people