I know that I can use something like MessageBox.Show("some error"), but I'm talking about an error that occurs at some lower level in my code that does not have a business throwing a MessageBox or any other GUI elements.
I am creating an RSS client, and I have a class that manages various feeds (say, FeedManager), which is just a wrapper for the list at the moment. Now this class calls another class to access the data. Therefore, at any time when someone from the GUI wants to save the feeds, the GUI just calls FeedManager.SaveFeeds(), which processes the channels and saves them to a file, database, etc. So I try to save the file and something bad happens (either something I encoded or excluded). So now I’m at least 3 levels, GUI→ FeedManager→ SomeDataAccessLayer, and I want to display a message to the user, for example: “Hey, this file was not found” or “You don’t know”, t have permission to write to this place " etc.
How should I do it? A surge MessageBoxfrom the data access layer visually connects this component with a graphical interface. All methods returning lines with error messages also seem silly.
source
share