Update ApiErrorMessageSafe to return null for empty and whitespace strings (#1540)

* return null if ApiError.Message is empty or whitespace

* Uncomment test, which now passes
This commit is contained in:
Sean Killeen
2017-01-16 08:13:00 -05:00
committed by Ryan Gribble
parent 620b1b9d89
commit 01a2d97212
2 changed files with 7 additions and 2 deletions
+1 -1
View File
@@ -349,7 +349,7 @@ namespace Octokit.Tests.Http
Assert.Equal(45, exception.RetryAfterSeconds);
}
[Fact(Skip = "Fails due to https://github.com/octokit/octokit.net/issues/1529. The message is empty but the default message isn't displayed. However, this isn't due to the introduction of AbuseException, but rather something else.")]
[Fact]
public async Task ThrowsAbuseExceptionWithDefaultMessageForUnsafeAbuseResponse()
{
string messageText = string.Empty;
+6 -1
View File
@@ -178,7 +178,12 @@ namespace Octokit
{
get
{
return ApiError != null ? ApiError.Message : null;
if (ApiError != null && !string.IsNullOrWhiteSpace(ApiError.Message))
{
return ApiError.Message;
}
return null;
}
}