exception - What could cause java.lang.reflect.InvocationTargetException?

You've added an extra level of abstraction by calling the method with reflection. The reflection layer wraps any exception in an InvocationTargetException, which lets you tell the difference between... Read More

java - Unable to run JUnit test with PowerMockRunner

This is a bug that occurs when you use JUnit 4.12 and PowerMock < 1.6.1. The problem is solved in PowerMock 1.6.1. Please update your dependencies accordingly testCompile 'junit:junit:4.12',... Read More

Add custom message to thrown exception while maintaining stack trace in Java

Try: throw new Exception("transction: " + transNbr, E);... Read More

java - Difference between using Throwable and Exception in a try catch

By catching Throwable it includes things that subclass Error. You should generally not do that, except perhaps at the very highest "catch all" level of a thread where you want to log or otherwise han... Read More

exception - Passing multiple error classes to ruby's rescue clause in a DRY fashion

You can use an array with the splat operator *. EXCEPTIONS = [FooException, BarException] begin a = rand if a > 0.5 raise FooException else raise BarException end rescue *EXCEPTIONS... Read More

python - Handle an exception thrown in a generator

When a generator throws an exception, it exits. You can't continue consuming the items it generates. Example: >>> def f(): ... yield 1 ... raise Exception ... yield 2 ... >>> g = f() >>>... Read More

c# - Sequence contains no matching element

Well, I'd expect it's this line that's throwing the exception: var documentRow = _dsACL.Documents.First(o => o.ID == id) First() will throw an exception if it can't find any matching elements. Given... Read More

c# - Could not load file or assembly ... The parameter is incorrect

Looks like a corrupted assembly being referenced. Clear both: the \bin folder of your project the temp folder (should be C:\Users\your_username\AppData\Local\Temp\Temporary ASP.NET Files in windows... Read More

exception - How to change the message in a Python AssertionError?

assert expression, info For instance, >>> assert False, "Oopsie" Traceback (most recent call last): File "<stdin>", line 1, in <module> AssertionError: Oopsie From the docs: Assert statements are... Read More

How do I log an exception at warning- or info-level with traceback using the python logging framework?

From the logging documentation: There are three keyword arguments in kwargs which are inspected: exc_info, stack_info, and extra. If exc_info does not evaluate as false, it causes exception informat... Read More