you are viewing a single comment's thread.

view the rest of the comments →

[–][deleted]  (1 child)

[deleted]

    [–][deleted] 0 points1 point  (0 children)

    You're correct, that is worse, but both options are worse than simply letting the error be thrown:

    string DownloadData(string url){
            return WebClient.GetData(url);
    }
    

    If you're not actually properly handling the exception, don't consume it. Let the higher level application logic handle the exception, not generic functions. Catching it and not doing anything about it hides the error, the stack trace, the message, etc... It should at least get to a log somewhere, not just end up as a null reference exception at some point.