Hi,
I was reading an article -
http://today.java.net/pub/a/today/2006/04/06/exception-handling-antipatterns.html
about exception handling and this paragraph took my attention:
"Wrapping an exception can provide extra information to the user by
adding your own message (as in the example above), while still
preserving the stack trace and message of the original exception. It
also allows you to hide the implementation details of your code, which
is the most important reason to wrap exceptions. For instance, look at
the Hibernate API. Even though Hibernate makes extensive use of JDBC
in its implementation, and most of the operations that it performs can
throw SQLException, Hibernate does not expose SQLException anywhere in
its API. Instead, it wraps these exceptions inside of various
subclasses of HibernateException. Using the approach allows you to
change the underlying implementation of your module without modifying
its public API."
I can catch MySql exceptions from nhibernate like this one: "Cannot
delete or update a parent row" (I know this is only the message but
the exception type is MySql.Data.MySqlClient.MySqlException)
Is this intentional or it will be modified in the future? What do you
think about it?
Thanks,
Cassio Tavares