sberlin commented on revision r1191 in project google-guice.
Details are at http://code.google.com/p/google-guice/source/detail?r=1191
Line-by-line comments:
File: /trunk/src/com/google/inject/internal/Errors.java (r1191)
===============================================================================
Line 370: if(runtimeException instanceof
Exceptions.UnhandledCheckedUserException) {
-------------------------------------------------------------------------------
Rolling down to getCause() == null would have the undesirable side-effect
of stripping away some of the user exceptions if they had a cause.
Consider a provider method:
@Provides DbConnection foo(DbConnector dbConnector) throws IOException
return dbConnector.newConnection();
}
DbConnector.newConnection() throws IOException {
try {
return new DbConnection(mysqlConnector.newConnection());
} catch(MySqlBlewUpException e) {
throw new IOException("MySql is down on connector: " + this, e);
}
}
... if we unrolled to getCause() == null, we lose the IOException from
within DbConnector and the message it contained (in this case, the toString
of the DbConnector object, which could contain useful info). The goal here
is to strip the Guice framework out of the causes & stacktrace, not the
user framework. We have to err on the side of caution with user code,
because we have no idea if the user wants their exceptions or not. If the
user doesn't want their exception, they can unwrap them prior to throwing.
Respond to these comments at
http://code.google.com/p/google-guice/source/detail?r=1191
--
You received this message because you starred this review, or because
your project has directed all notifications to a mailing list that you
subscribe to.
You may adjust your review notification preferences at:
http://code.google.com/hosting/settings
--
You received this message because you are subscribed to the Google Groups
"google-guice-dev" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/google-guice-dev?hl=en.