GoogleCodeArchive / piccolo2d

Automatically exported from code.google.com/p/piccolo2d
0 stars 0 forks source link

PNode.print swallows failures #102

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Call print() on any node and have an exception occur.

What is the expected output? What do you see instead?
Someone should be notified of the failure.  The best way of doing this
would be to throw the PrinterException instead of burying it.

Please use labels and text to provide additional information.
Applying this change will break binary compatibility with client code, but
I can't think of any other way of getting rid of the printStackTrace and
the System.out.println, so this change so be rolled into v 2.0

Original issue reported on code.google.com by allain.lalonde on 18 Jul 2009 at 11:45

GoogleCodeExporter commented 9 years ago
r562 changed this to throw RuntimeException, is that sufficient?

Original comment by heue...@gmail.com on 28 Jul 2009 at 2:37

GoogleCodeExporter commented 9 years ago
I wish it were but it's just way too subtle. It's way too easy to not notice a
RuntimeException. Since printing involves IO, the best approach (in my humble
opinion) is to force a checked exception. This is the kind of thing checked
exceptions are intended for. 

Original comment by allain.lalonde on 28 Jul 2009 at 3:55

GoogleCodeExporter commented 9 years ago
What's a dedicated print method good for anyway? Isn't that better done in the
application rather than the library?

I'd vote for removing the method in 2.0.

Original comment by mr0...@mro.name on 28 Jul 2009 at 9:03

GoogleCodeExporter commented 9 years ago
I agree with removing it, but... we should provide a PrintingExample 
demonstrating
how to do it.

Original comment by allain.lalonde on 28 Jul 2009 at 12:04

GoogleCodeExporter commented 9 years ago
Made it bubble up the exception in r1012

Original comment by allain.lalonde on 17 Apr 2010 at 2:28

GoogleCodeExporter commented 9 years ago

Original comment by heue...@gmail.com on 26 Nov 2013 at 9:11