yuskam / catch-exception

Automatically exported from code.google.com/p/catch-exception
0 stars 0 forks source link

Document verifying constructor exceptions #11

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
I was about to raise a bug that c-e doesn't help capture exceptions from 
constructors but now realise why it is not possible without using a Builder.

It doesn't seem worth it/clean to define a c-e specific Builder interface but 
maybe you could add doc to the front page about doing this using something like 
Guava's Supplier

Supplier<Thing> builder = new Supplier<Thing>() {
  @Override
  public Thing get() {
    return new Thing("baddata");
  }
};
verifyException(builder).get();

Original issue reported on code.google.com by drekb...@gmail.com on 29 Nov 2013 at 2:17

GoogleCodeExporter commented 8 years ago
Nice example. 

I added it to the front page.

Cheers
Rod

Original comment by rwoo@gmx.de on 1 Dec 2013 at 1:16