how to find out if an exception's message will be localized...
Something a little different to figure out today.
I have a piece of code in a try catch block that swallows a COMException. However, based on the message of the exception I'll want to rethrow it and add the original exception as an inner exception. During my code review yesterday, the question of localization came up...and honestly, I don't know if a COMException's message is localized or not on OS's for different languages (other than English).
Anyone have a suggestion where to look for information about this? I'm not having much luck on MSDN, it doesn't really give much in the way of localization information.
Comments
- Anonymous
June 22, 2005
Why would you want to check this based on the message? Could you just check the HRESULT? - Anonymous
June 22, 2005
In all the cases I've seen in the frameworks, the exception message is localized - if at all possible, just treat it as a string blob and don't depend on or try to parse the contents. There should be enough info in the other members of the exception object to do whatever you're trying to do - or we didn't design and/or use that exception correctly. - Anonymous
June 23, 2005
Yup, that's what I ended up doing PatriotB...thanks for the suggestion. :) - Anonymous
June 23, 2005
Thanks for the input Bruce...I did end up using the HRESULT instead. :)