Skip to content

Commit

Permalink
Catching mongo error in TrackEvent
Browse files Browse the repository at this point in the history
  • Loading branch information
NizamLZ committed Jul 3, 2017
1 parent 4c5df98 commit 6da79b7
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 12 deletions.
15 changes: 11 additions & 4 deletions ANAConversationPlatform/Helpers/MongoHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -305,11 +305,18 @@ private static Section GetSection(BsonDocument sectionBsonDocument)

public static void InsertActivityEvent(ChatActivityEvent activityEvent)
{
if (activityEvent != null && string.IsNullOrWhiteSpace(activityEvent._id))
activityEvent._id = ObjectId.GenerateNewId().ToString();
try
{
if (activityEvent != null && string.IsNullOrWhiteSpace(activityEvent._id))
activityEvent._id = ObjectId.GenerateNewId().ToString();

var coll = ChatDB.GetCollection<ChatActivityEvent>(Settings.ActivityEventLogCollectionName);
coll.InsertOne(activityEvent);
var coll = ChatDB.GetCollection<ChatActivityEvent>(Settings.ActivityEventLogCollectionName);
coll.InsertOne(activityEvent);
}
catch (Exception ex)
{
Logger.LogError(new EventId((int)LoggerEventId.MONGO_HELPER_ERROR), ex, "InsertActivityEvent: {0}", ex.Message);
}
}
}
}
2 changes: 1 addition & 1 deletion ANAConversationSimulator/Package.appxmanifest
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<Package xmlns="http://schemas.microsoft.com/appx/manifest/foundation/windows10" xmlns:mp="http://schemas.microsoft.com/appx/2014/phone/manifest" xmlns:uap="http://schemas.microsoft.com/appx/manifest/uap/windows10" IgnorableNamespaces="uap mp">
<Identity Name="44cabbc3-0a2f-4255-b5bb-b099cd5762f9" Publisher="CN=ProjectANA" Version="1.0.63.0" />
<Identity Name="44cabbc3-0a2f-4255-b5bb-b099cd5762f9" Publisher="CN=ProjectANA" Version="1.0.65.0" />
<mp:PhoneIdentity PhoneProductId="44cabbc3-0a2f-4255-b5bb-b099cd5762f9" PhonePublisherId="00000000-0000-0000-0000-000000000000" />
<Properties>
<DisplayName>ANA Conversation Simulator</DisplayName>
Expand Down
17 changes: 10 additions & 7 deletions ANAConversationSimulator/ViewModels/MainPageViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -233,14 +233,17 @@ public async void ProcessNode(JToken node, JToken section = null)
{
await Task.Run(async () =>
{
try
await Windows.ApplicationModel.Core.CoreApplication.MainView.CoreWindow.Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, async () =>
{
await APIHelper.TrackEvent(Utils.GetViewEvent(parsedNode.Id, Utils.DeviceId));
}
catch (Exception ex)
{
await Utils.ShowDialogAsync(ex.ToString());
}
try
{
await APIHelper.TrackEvent(Utils.GetViewEvent(parsedNode.Id, Utils.DeviceId));
}
catch (Exception ex)
{
await Utils.ShowDialogAsync(ex.ToString());
}
});
});
}
AddIncommingSection(parsedSection);
Expand Down

0 comments on commit 6da79b7

Please sign in to comment.