I am developing in the user interface layer of the application, and after I make the request, an exception is thrown at the business level (or lower). The exception is as follows
"Fix System.Exception: data not returned ..."
Which of its obvious ones did someone simple:
if (...Rows.Count < 1) throw new Exception("No Data Returned");
Now on my playground, I should try to clear this, trying to restore it as a custom exception, which I can handle just like this:
try { var myBusinessObject = MyBusinessMethod(); } catch (Exception ex) { if (ex.Message == "No Data Returned") { throw new NoDataException(ex.Message); } else { throw; } }
Or is there a more graceful way to handle them.
Please note: I do not have the ability to modify code outside of the user interface level, and I expect that you will often come across this particular exception.
Thanks in advance!
source share