I have a function: Task<Result> GetSomething(string params) { var website = getWeb(params); if (website.StatusCode != HttpStatusCode.OK) { //do something } else { return website } } I have some solutions to deal with error: return null return a tuple with the result and a bool indicates if successful or not, like return (null, false); andRead more