M
M
Mercury132017-04-24 13:03:42
OOP
Mercury13, 2017-04-24 13:03:42

Who that can tell about technology of localization of exceptions?

The most convenient way to declare an error at point A and react to it at point B is through exceptions. But they do not work well with localization and internationalization technologies. For example, a general purpose library may not have a localization library.
How do you localize accidents in general? At the first opportunity, do you turn it into a LocalizedException (and in highly specialized code, inherit from LocalizedException, and that’s all)? Thinking about how to localize only when you need to display a message on the screen? Any other way?
UPD. I credited the solution to an interesting interlocutor, although the task was partially solved.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Denis Zagaevsky, 2017-04-24
@Mercury13

The exception (and its text) is not what the user should see. In the place where the exception is caught and you need to say something to the user, you have an architectural error, because exceptions are not for normal situations when an error occurs due to the user's fault.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question