IWETHEY v. 0.3.0 | TODO
1,095 registered users | 0 active users | 0 LpH | Statistics
Login | Create New User
IWETHEY Banner

Welcome to IWETHEY!

New That would lead to a lot of exception classes
Basically what you are suggesting is that for every possible error create a new exception class. That is problematic for a number of reasons.
1. You then end up throwing a long list of exceptions making every one catch or throw the long list. The whole point of wrapping exceptions is so that the gui only ends up having to catch a small number of exceptions
2. You end up with a large number of exception classes
Expand Edited by bluke March 9, 2004, 09:31:14 AM EST
New Create a wrapper exception class
call it LocalizedException and provide messageKey and messageParams methods. Use the messageKey to lookup a format string in a resource bundle containing a message format string - then unify that with the messageParams with java.text.MessageFormat.

You can have the exception class do the lookup of the bundle, or leave it to client code. I'd be inclined to put it in the exception itself - implementing something like toString(locale).



The tree of research must from time to time be refreshed with the blood of bean counters.
     -- Alan Kay
     I18N (internationalization) and exceptions - (bluke) - (3)
         Use exception's class name as a key? -NT - (Arkadiy) - (2)
             That would lead to a lot of exception classes - (bluke) - (1)
                 Create a wrapper exception class - (tuberculosis)

... should the Index Book of Everything in the Library contain a listing for
... The Index Book?
... which is also in the Library.
... or would that belong in the Meta-Index..
... or The List of Lists...
... or The Index of Indices....
... which Cannot be placed In The Library.....!
... (but only in the Meta-Library???)

57 ms