Actions to throw Throwable?

2 views
Skip to first unread message

Eric Lefevre-Ardant

unread,
Nov 8, 2010, 9:30:55 AM11/8/10
to narrati...@googlegroups.com
Hi,

I often find myself writing Actions whose performFor() method ends up calling another method that throws a checked exception.
I then have to wrap the call in a try/catch clause.

I don't want to do that. More accurately, I don't want to bother.

How about just having the signature for performFor() just throw Throwable? (a bit like the test methods in a JUnit test)
All exceptions will of course then have to be handle appropriately in Narrative - naming by breaking immediately, I guess.

Thoughts?

Eric

Douglas Squirrel

unread,
Nov 8, 2010, 5:21:05 PM11/8/10
to narrati...@googlegroups.com

youDevisers, how do we handle this internally?

 

Eric, I'll file a new GitHub issue describing this idea and invite comment there.

Andrew Parker

unread,
Nov 9, 2010, 2:54:32 AM11/9/10
to narrati...@googlegroups.com
I think we have always just wrapped the code in a try/catch. The problem has either been ignored by us (not great) or we don't have it crop up too much because we usually avoid checked exceptions.

Have you tried out adding Throwable? I would be concerned that it would add warnings in the compiler for IDE.
________________________________________
From: narrati...@googlegroups.com [narrati...@googlegroups.com] On Behalf Of Douglas Squirrel [douglas....@youdevise.com]
Sent: Monday, November 08, 2010 10:21 PM
To: narrati...@googlegroups.com
Subject: RE: Actions to throw Throwable?

Eric Lefevre-Ardant

unread,
Nov 9, 2010, 4:25:52 AM11/9/10
to narrati...@googlegroups.com
We too have few checked exceptions. But they are still there because of the external libraries we use (when a lib declares an exception, we usually just declare it ourselves, as we rarely want to deal with it locally).

To add Throwable to the signature, I'd have to change the signature of performFor() in the Action interface. I haven't looked at forking the source code yet.

Eric
Reply all
Reply to author
Forward
0 new messages