vb.net - Catch, Handle, then Rethrow Exception? -


Today I ran into an interesting dilemma I have a function that handles information and checks for duplicate values , Then returns the next number that is not a duplicate. So, I have something like this:

  Long / non-duplicate function will return a dim non-duplicate if the Folk Function GetNextNonDuplicateNumber (check number as long) if CheckForDuplicate ( NumberToCheck) = True then in the lower part of the Function for For Future  

function I have a catch block which handles duplication unless I have a duplicate

As you can see, I want to duplicate Catch as freight Akspasn Nondipliket = Inkrementtioandupliket value (Nanbrtoc) to exclusively handle the exception, but I want to throw it whenever I want to warn other code outside the function.

The problem is that by thrown it exits with a null value of the function whether I am thinking of a try / catch Am, or is there a way around it?

If you have taken an exception and have recovered from it (with your increase copy. .) So there is no reason to throw an exception. Between the grip and the end efforts, the code should only clean up resources such as shutting down the file or detirerer, if you restore it.

You can return a structure that contains information about errors in non-duplicate value and function. Otherwise, a custom exception has to be thrown in which "invalid numbers should be like ...)"


Comments

Popular posts from this blog

c++ - Linux and clipboard -

What is expire header and how to achive them in ASP.NET and PHP? -

sql server - How can I determine which of my SQL 2005 statistics are unused? -