Skip to content

Commit aa6c700

Browse files
Version Bump v9.1.1: #358: SendGridClient.SendEmailAsync now throws original exception
1 parent 63f8339 commit aa6c700

File tree

7 files changed

+21
-26
lines changed

7 files changed

+21
-26
lines changed

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
# Change Log
22
All notable changes to this project will be documented in this file.
33

4+
## [9.1.1] - 2017-04-12
5+
## Fix
6+
- PR #358: SendGridClient.SendEmailAsync now throws original exception
7+
- Thanks to [Otto Dandenell](https://github.com/ottomatic) for the PR!
8+
49
## [9.1.0] - 2017-03-20
510
## Update
611
- PR #405: Reuse HTTP Client

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@ var client = new SendGridClient(proxy, apiKey);
177177
- [How-to: Migration from v2 to v3](https://sendgrid.com/docs/Classroom/Send/v3_Mail_Send/how_to_migrate_from_v2_to_v3_mail_send.html)
178178
- [v3 Web API Mail Send Helper](https://github.com/sendgrid/sendgrid-csharp/tree/master/SendGrid/SendGrid/Helpers/Mail)
179179

180-
<a name="use_cases">
180+
<a name="use_cases"></a>
181181
# Use Cases
182182

183183
[Examples of common API use cases](https://github.com/sendgrid/sendgrid-csharp/blob/master/USE_CASES.md), such as how to send an email with a transactional template.

nuspec/Sendgrid.9.1.0.nuspec renamed to nuspec/Sendgrid.9.1.1.nuspec

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<package xmlns="http://schemas.microsoft.com/packaging/2012/06/nuspec.xsd">
33
<metadata>
44
<id>Sendgrid</id>
5-
<version>9.1.0</version>
5+
<version>9.1.1</version>
66
<title>SendGrid</title>
77
<authors>Elmer Thomas,SendGrid DX Team</authors>
88
<licenseUrl>https://github.com/sendgrid/sendgrid-csharp/blob/master/MIT.LICENSE</licenseUrl>
@@ -11,8 +11,9 @@
1111
<requireLicenseAcceptance>false</requireLicenseAcceptance>
1212
<description>C# client library and examples for using SendGrid API's to send mail and access Web API v3 endpoints with .NET Standard 1.3 and .NET Core support. Github repo located at : https://github.com/sendgrid/sendgrid-csharp</description>
1313
<summary>C# client library and examples for using SendGrid API's to send mail and access Web API v3 endpoints with .NET Standard 1.3 and .NET Core support.</summary>
14-
<releaseNotes>- PR #405: Reuse HTTP Client
15-
- Thanks to [Jonny Bekkum](https://github.com/jonnybee) for the PR!</releaseNotes>
14+
<releaseNotes>## Fix
15+
- PR #358: SendGridClient.SendEmailAsync now throws original exception
16+
- Thanks to [Otto Dandenell](https://github.com/ottomatic) for the PR!</releaseNotes>
1617
<copyright>SendGrid, Inc. 2017</copyright>
1718
<tags>SendGrid Email Mail Microsoft Azure Transactional .NET Core</tags>
1819
<dependencies>

src/SendGrid/Properties/AssemblyInfo.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,4 +22,4 @@
2222
// The following GUID is for the ID of the typelib if this project is exposed to COM
2323
[assembly: Guid("377c20e4-2297-488f-933b-fb635c56d8fc")]
2424

25-
[assembly: AssemblyInformationalVersion("9.1.0")]
25+
[assembly: AssemblyInformationalVersion("9.1.1")]

src/SendGrid/SendGridClient.cs

Lines changed: 9 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,6 @@ public class SendGridClient
5454
/// <returns>Interface to the SendGrid REST API</returns>
5555
public SendGridClient(IWebProxy webProxy, string apiKey, string host = null, Dictionary<string, string> requestHeaders = null, string version = "v3", string urlPath = null)
5656
{
57-
5857
// Create client with WebProxy if set
5958
if (webProxy != null)
6059
{
@@ -75,7 +74,7 @@ public SendGridClient(IWebProxy webProxy, string apiKey, string host = null, Dic
7574
}
7675

7776
/// <summary>
78-
/// Constructor. Initializes a new instance of the <see cref="SendGridClient"/> class.
77+
/// Initializes a new instance of the <see cref="SendGridClient"/> class.
7978
/// </summary>
8079
/// <param name="httpClient">An optional http client which may me injected in order to facilitate testing.</param>
8180
/// <param name="apiKey">Your SendGrid API key.</param>
@@ -84,14 +83,13 @@ public SendGridClient(IWebProxy webProxy, string apiKey, string host = null, Dic
8483
/// <param name="version">API version, override AddVersion to customize</param>
8584
/// <param name="urlPath">Path to endpoint (e.g. /path/to/endpoint)</param>
8685
/// <returns>Interface to the SendGrid REST API</returns>
87-
public SendGridClient(HttpClient httpClient, string apiKey, string host = null, Dictionary<string, string> requestHeaders = null, string version = "v3", string urlPath = null)
86+
public SendGridClient(HttpClient httpClient, string apiKey, string host = null, Dictionary<string, string> requestHeaders = null, string version = "v3", string urlPath = null)
8887
{
8988
client = (httpClient == null) ? new HttpClient() : httpClient;
9089

9190
InitiateClient(apiKey, host, requestHeaders, version, urlPath);
9291
}
9392

94-
9593
/// <summary>
9694
/// Initializes a new instance of the <see cref="SendGridClient"/> class.
9795
/// </summary>
@@ -102,18 +100,18 @@ public SendGridClient(HttpClient httpClient, string apiKey, string host = null,
102100
/// <param name="urlPath">Path to endpoint (e.g. /path/to/endpoint)</param>
103101
/// <returns>Interface to the SendGrid REST API</returns>
104102
public SendGridClient(string apiKey, string host = null, Dictionary<string, string> requestHeaders = null, string version = "v3", string urlPath = null)
105-
: this(httpClient: null, apiKey: apiKey,host: host, requestHeaders: requestHeaders, version: version, urlPath: urlPath)
103+
: this(httpClient: null, apiKey: apiKey, host: host, requestHeaders: requestHeaders, version: version, urlPath: urlPath)
106104
{
107105
}
108106

109107
/// <summary>
110108
/// Common method to initiate internal fields regardless of which constructor was used.
111109
/// </summary>
112-
/// <param name="apiKey"></param>
113-
/// <param name="host"></param>
114-
/// <param name="requestHeaders"></param>
115-
/// <param name="version"></param>
116-
/// <param name="urlPath"></param>
110+
/// <param name="apiKey">Your SendGrid API key.</param>
111+
/// <param name="host">Base url (e.g. https://api.sendgrid.com)</param>
112+
/// <param name="requestHeaders">A dictionary of request headers</param>
113+
/// <param name="version">API version, override AddVersion to customize</param>
114+
/// <param name="urlPath">Path to endpoint (e.g. /path/to/endpoint)</param>
117115
private void InitiateClient(string apiKey, string host, Dictionary<string, string> requestHeaders, string version, string urlPath)
118116
{
119117
UrlPath = urlPath;
@@ -122,7 +120,6 @@ private void InitiateClient(string apiKey, string host, Dictionary<string, strin
122120
var baseAddress = host ?? "https://api.sendgrid.com";
123121
var clientVersion = GetType().GetTypeInfo().Assembly.GetName().Version.ToString();
124122

125-
126123
// standard headers
127124
client.BaseAddress = new Uri(baseAddress);
128125
Dictionary<string, string> headers = new Dictionary<string, string>
@@ -160,7 +157,6 @@ private void InitiateClient(string apiKey, string host, Dictionary<string, strin
160157
client.DefaultRequestHeaders.Add(header.Key, header.Value);
161158
}
162159
}
163-
164160
}
165161

166162
/// <summary>
@@ -226,7 +222,7 @@ public virtual AuthenticationHeaderValue AddAuthorization(KeyValuePair<string, s
226222
/// <param name="urlPath">The path to the API endpoint.</param>
227223
/// <param name="cancellationToken">Cancel the asynchronous call.</param>
228224
/// <returns>Response object</returns>
229-
/// <exception cref="Exception">The method will NOT catch and swallow exceptions generated by sending a request
225+
/// <exception cref="Exception">The method will NOT catch and swallow exceptions generated by sending a request
230226
/// through the internal http client. Any underlying exception will pass right through.
231227
/// In particular, this means that you may expect
232228
/// a TimeoutException if you are not connected to the internet.</exception>

src/SendGrid/project.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,5 +48,5 @@
4848
}
4949
}
5050
},
51-
"version": "9.1.0"
51+
"version": "9.1.1"
5252
}

tests/SendGrid.Tests/Integration.cs

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ public class IntegrationFixture : IDisposable
1616
{
1717
public IntegrationFixture()
1818
{
19-
2019
if (Environment.GetEnvironmentVariable("TRAVIS") != "true")
2120
{
2221
Trace.Listeners.Add(new TextWriterTraceListener(Console.Out));
@@ -5797,7 +5796,6 @@ public async Task TestTakesHttpClientFactoryAsConstructorArgumentAndUsesItInHttp
57975796
Assert.Equal(httpResponse, response.Body.ReadAsStringAsync().Result);
57985797
}
57995798

5800-
58015799
/// <summary>
58025800
/// Tests the conditions in issue #358.
58035801
/// When an Http call times out while sending a message,
@@ -5843,10 +5841,7 @@ public async Task TestWhenHttpCallTimesOutThenExceptionIsThrown()
58435841
// If we are certain that we don't want custom exceptions to be thrown,
58445842
// we can also test that the original exception was thrown
58455843
Assert.IsType(typeof(TimeoutException), thrownException);
5846-
5847-
58485844
}
5849-
58505845
}
58515846

58525847
public class FakeHttpMessageHandler : HttpMessageHandler
@@ -5880,7 +5875,6 @@ public override HttpResponseMessage Send(HttpRequestMessage request)
58805875
Content = new StringContent(message)
58815876
};
58825877
}
5883-
58845878
}
58855879

58865880
/// <summary>
@@ -5904,6 +5898,5 @@ public override HttpResponseMessage Send(HttpRequestMessage request)
59045898
Thread.Sleep(timeOutMilliseconds);
59055899
throw new TimeoutException(exceptionMessage);
59065900
}
5907-
59085901
}
59095902
}

0 commit comments

Comments
 (0)