My Exception classes

Started by
0 comments, last by wah_on_2 20 years, 8 months ago
Hihi, i am writing utilities classes using C#. The utilities contain my own exceptional classes. Until now, my design about the exceptional classes is that: I have my expceitonal class and inherit from ApplicationException and i will assign a message to it when creating the instance of it for more details to identify what''s the problems are. The message is not hardcode in program, the exceptional classes will call a MessageReader class to get the message from a text file by passing a MessageKey for mapping. In this case, i should collect all the messages in a text file, and i confuse with that. I think i should seperate the different exception''s message in different file. For example, at least i will have Common Message(e.g. Out of range) and Applicaiton Message(e.g. field cannot be empty). And then, when the program create common''s exception, the MessageReader will get ,message from common file. However, if i use this method, i will have many message file and it seem difficult to maintain. So i want to know how to do the exception class in a better way? How the .NET to do it? Is it same with me? Does my method correct?
Advertisement
If anyone know how to do exception without hardcode the message in the program. Pls share expenience with me. I feel difficult to handle it.

This topic is closed to new replies.

Advertisement