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

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

java throwing checked exceptions?

I am pretty sure that this worked before, but eclipse says there is error with it in throw line. try{} }catch(Exception e){ throw e; } In my old student project I...
Jon Skeet
people
quotationmark

Presumably your method is declared to throw UnsupportedAddressTypeException but not SQLException and ClassNotFoundException. Checked exceptions can only be thrown (including rethrowing an existing one) from methods which declare that they... more

people

How to distinguish different plain exceptions?

If I don't want to create custom-exceptions, then how to distinguish them when catching ? if (somethingIsWrong) throw new Exception("Something is wrong."); else if...
Jon Skeet
people
quotationmark

Creating your own exception type is the solution here. You could set the HResult on an exception and throw it that way - but it's a horrible thing to do. The language has been designed to catch exceptions based on their type rather than... 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