You searched for exceptions. We found 381 results in 0.062 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

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

Where are exceptions inside tasks stored?

If I'll uncomment the line with Wait() or startNew.Result in the following sample I'll catch the AggregateException. Why can't I see any exceptions if these lines of code are...
Jon Skeet
people
quotationmark

But why can't I see any exceptions if these lines of code are commented? Because nothing's throwing them! You really don't want an exception from one thread to be thrown in a different thread at an arbitrary point without you doing... more

people

Will Exceptions affect the performance of an application?

I have a C# application..I continuously get a null reference exception..I manage to catch this exception and log it..But i doubt if this exception will affect the performance of...
Jon Skeet
people
quotationmark

If you're getting a NullReferenceException, you should fix it rather than catching it. You should only ever catch it if it occurs in code in a way that you cannot fix (e.g. a broken third party library). A NullReferenceException always... more

people

How to OR when capturing multiple webdriver exceptions

I am trying to capture multiple exceptions like this but I get error '); expected'. How do I do it using ||? try { //find an element here }catch(...
Jon Skeet
people
quotationmark

Assuming you're using Java 7, you should be able to use this syntax: catch (StaleElementReferenceException | NoSuchElementException e) Note the single |, as well as the single variable name. See the "Catching Multiple Exception Types... more

people

Handle or not to handle null parameters with exceptions

I remember reading some exception handling guidance that checking for null parameters was discouraged. The justification for this was, that if you left the code as is, an...
Jon Skeet
people
quotationmark

This gives the same effect but you're right extra lines of code No it doesn't. Consider: public void TransferMoney(Account from, Account to, decimal amount) { from.Debit(amount); to.Credit(amount); } vs public void... more

people

Java SneakyThrow of exceptions, type erasure

Can someone explain this code? public class SneakyThrow { public static void sneakyThrow(Throwable ex) { SneakyThrow.<RuntimeException>sneakyThrowInner(ex); } ...
Jon Skeet
people
quotationmark

If you compile it with -Xlint you'll get a warning: c:\Users\Jon\Test>javac -Xlint SneakyThrow.java SneakyThrow.java:9: warning: [unchecked] unchecked cast throw (T) ex; ^ required: T found: Throwable where T... more

people

Why are exceptions named checked and unchecked?

Why is the two exception types in Java named "checked" and "unchecked"? What is the reason behind those names?
Jon Skeet
people
quotationmark

If you call a method which is declared to throw a checked exception (such as IOException), the compiler will check that you're either catching it or declaring that you rethrow it. Likewise, in order to throw such a checked exception in the... more

people

Fields to save in database when Handling C# Exceptions

I am going to handle a project to a client for a testing phase, the project build with ASP.NET MVC3 .. What I need is to save all exceptions occurs to a persistent location -SQL...
Jon Skeet
people
quotationmark

what field should I save in the database? (Msg, trace, etc) Everything you can, if possible: Type Message Stack trace I have seen people save the inner exception but sometimes my exceptions have null inner exception. And some... more

people

Is this pattern for handling IO exceptions in Java correct?

In the following code snippet, if ex1 is thrown, will be be caught by the second catch block, or will it be thrown back to the caller of the method? And if it is thrown back to...
Jon Skeet
people
quotationmark

Both of those exceptions would be thrown back to the caller... although a single exception in any particular situation. If the body of the outer try block throws and then close throws as well, only the second exception would be seen by the... more

people