Created
January 11, 2014 20:04
-
-
Save scichelli/8376006 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class MyCoolService | |
{ | |
public Result<CoolThing> Fetch(Uri uri) | |
{ | |
HttpResponseMessage response = CallThatThingInTheCloud(uri); | |
if (response.IsSuccessStatusCode) | |
{ | |
return new Result<CoolThing> | |
{ | |
IsSuccess = true, | |
Results = Deserialize(response) | |
}; | |
} | |
return new Result<CoolThing> | |
{ | |
IsSuccess = false, | |
ErrorMessage = string.Format("Error {0}: {1}", | |
response.StatusCode, response.ReasonPhrase) | |
}; | |
} | |
//... | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment