Skip to content

Commit 4e7dd5d

Browse files
author
Warren Buckley
committed
Add some logging & adds System.Net.Http.Json to help with POSTing as JSON
1 parent 46ff5e5 commit 4e7dd5d

File tree

2 files changed

+14
-2
lines changed

2 files changed

+14
-2
lines changed

src/Umbraco.Forms.Extensions.Crm.Hubspot/HubspotWorkflow.cs

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
1-
using System;
1+
using Newtonsoft.Json;
2+
using System;
23
using System.Collections.Generic;
4+
using System.Net.Http;
5+
using System.Net.Http.Json;
6+
using Umbraco.Core.Composing;
7+
using Umbraco.Core.Logging;
38
using Umbraco.Forms.Core;
9+
using Umbraco.Forms.Core.Attributes;
410
using Umbraco.Forms.Core.Enums;
511
using Umbraco.Forms.Core.Persistence.Dtos;
612

@@ -57,7 +63,12 @@ public override List<Exception> ValidateSettings()
5763
// The API key provided is invalid. View or manage your API key here: https://app.hubspot.com/l/api-key/
5864
var errorResponse = testResponse.Content.ReadAsStringAsync().Result;
5965
var errorObj = JsonConvert.DeserializeObject<ErrorResponse>(errorResponse);
60-
errors.Add(new Exception(errorObj.message));
66+
var ex = new Exception(errorObj.message);
67+
errors.Add(ex);
68+
69+
// Log the error
70+
// TODO: Unable to get Form Name & Form ID for logging context properties
71+
Current.Logger.Error<HubspotWorkflow>(ex, "Workflow {WorkflowName}: Error checking HubSpot Connection for {FormName} ({FormId})", Workflow.Name);
6172
}
6273

6374
return errors;

src/Umbraco.Forms.Extensions.Crm.Hubspot/Umbraco.Forms.Extensions.Crm.Hubspot.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
</PropertyGroup>
1919

2020
<ItemGroup>
21+
<PackageReference Include="System.Net.Http.Json" Version="5.0.0" />
2122
<PackageReference Include="UmbracoForms.Core" Version="8.7.4" />
2223
</ItemGroup>
2324

0 commit comments

Comments
 (0)