diff --git a/Src/Notion.Client/RestClient/RestClient.cs b/Src/Notion.Client/RestClient/RestClient.cs index b52b0ce3..bba3a866 100644 --- a/Src/Notion.Client/RestClient/RestClient.cs +++ b/Src/Notion.Client/RestClient/RestClient.cs @@ -64,8 +64,9 @@ private static async Task BuildException(HttpResponseMessage response { errorResponse = JsonConvert.DeserializeObject(errorBody); } - catch + catch (Exception ex) { + Log.Error(ex, "Error when parsing the notion api response."); } } @@ -84,7 +85,7 @@ public async Task SendAsync( requestUri = AddQueryString(requestUri, queryParams); - HttpRequestMessage httpRequest = new HttpRequestMessage(httpMethod, requestUri); + using var httpRequest = new HttpRequestMessage(httpMethod, requestUri); httpRequest.Headers.Authorization = new AuthenticationHeaderValue("Bearer", _options.AuthToken); httpRequest.Headers.Add("Notion-Version", _options.NotionVersion);