You searched for exceptions
. We found 168
results in 0.078 seconds.
An initializer block can only throw unchecked exceptions, or checked exceptions which are declared to be thrown by all constructors. (This includes exceptions which are subclasses of those which are declared.) You can't throw a checked... more
When an exception occurs in an async method, it doesn't just propagate up the stack like it does in synchronous code. Heck, the logical stack is likely not to be there any more. Instead, the exception is stored in the task which... more
You have three problems here: You're using a PrintStream for no reason, and that will swallow exceptions. You're writing data using an ObjectOutputStream, i.e. creating a binary file of Java serialized objects, but you're trying to read... more
I have a method that is used in the wrong scenario (it's basic assumption doesn't hold). That sounds like an exact match for IllegalStateException: Signals that a method has been invoked at an illegal or inappropriate... more
ClassNotFoundException is a checked exception - and you can't declare that a method override will throw any checked exceptions that the method it's overriding doesn't declare. From section 8.4.8.3 of the JLS: A method that overrides... more
Your code won't even compile cleanly at the moment, as the x++; statement is unreachable. Always pay attention to warnings. However, after fixing that, it works fine: using System; using System.Threading.Tasks; class Test { static... more
Will the re-thrown exception maintain the exception type that originally entered the catch clause? Yes - it will rethrow the exact same exception object. You need to differentiate between the compile-time type of ex (which is... more
I'd usually go with [ExpectedException(typeof(MyException)] I suggest you don't do that. You haven't told us which unit test framework you're using, but these days most provide something like: Assert.Throws<MyException>(()... more
Can this be always generalised and be said that in the import statement, the first one would be java/javax (is there any other?), the second one package, the third class and the fourth, if any will always be a method belonging to the... more
This one: Is this a physical location thing where the same message may be presented based on things like locale, timezone, etc. Although it's usually just locale / culture, really. Basically imagine that an error message of "The... more