Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix for issue #57 #60

Open
wants to merge 7 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions BaconBackend/Collectors/CommentCollector.cs
Original file line number Diff line number Diff line change
Expand Up @@ -450,7 +450,7 @@ public bool CommentAddedOrEdited(string parentOrOrgionalId, string serverRespons
{
// We fucked up adding the comment to the UI.
m_baconMan.MessageMan.DebugDia("Failed injecting comment", e);
m_baconMan.TelemetryMan.ReportUnExpectedEvent(this, "AddCommentSuccessButAddUiFailed");
m_baconMan.TelemetryMan.ReportUnexpectedEvent(this, "AddCommentSuccessButAddUiFailed");
}

// If we get to adding to the UI return true because reddit has the comment.
Expand All @@ -460,7 +460,7 @@ public bool CommentAddedOrEdited(string parentOrOrgionalId, string serverRespons
{
// Reddit returned something wrong
m_baconMan.MessageMan.ShowMessageSimple("That's not right", "Sorry we can't post your comment right now, reddit returned and unexpected message.");
m_baconMan.TelemetryMan.ReportUnExpectedEvent(this, "CommentPostReturnedUnexpectedMessage");
m_baconMan.TelemetryMan.ReportUnexpectedEvent(this, "CommentPostReturnedUnexpectedMessage");
return false;
}
}
Expand Down
2 changes: 1 addition & 1 deletion BaconBackend/Collectors/MessageCollector.cs
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ public void ChangeMessageReadStatus(Message message, bool isRead, int messagePos
catch (Exception ex)
{
m_baconMan.MessageMan.DebugDia("failed to set message status!", ex);
m_baconMan.TelemetryMan.ReportUnExpectedEvent(this, "failedToSetMessageRead", ex);
m_baconMan.TelemetryMan.ReportUnexpectedEvent(this, "failedToSetMessageRead", ex);
}
});
}
Expand Down
4 changes: 2 additions & 2 deletions BaconBackend/Collectors/PostCollector.cs
Original file line number Diff line number Diff line change
Expand Up @@ -460,7 +460,7 @@ public bool EditSelfPost(Post post, string serverResponse)
{
// We fucked up updating the UI for the post edit.
m_baconMan.MessageMan.DebugDia("Failed updating selftext in UI", e);
m_baconMan.TelemetryMan.ReportUnExpectedEvent(this, "FailedUpdatingSelftextInUI");
m_baconMan.TelemetryMan.ReportUnexpectedEvent(this, "FailedUpdatingSelftextInUI");
}

// If the response was ok always return true.
Expand All @@ -470,7 +470,7 @@ public bool EditSelfPost(Post post, string serverResponse)
{
// Reddit returned something wrong
m_baconMan.MessageMan.ShowMessageSimple("That's not right", "We can't edit your post right now, reddit returned and unexpected message.");
m_baconMan.TelemetryMan.ReportUnExpectedEvent(this, "CommentPostReturnedUnexpectedMessage");
m_baconMan.TelemetryMan.ReportUnexpectedEvent(this, "CommentPostReturnedUnexpectedMessage");
return false;
}
}
Expand Down
18 changes: 9 additions & 9 deletions BaconBackend/Helpers/MiscellaneousHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ public static async Task<string> SendRedditComment(BaconManager baconMan, string
}
catch (Exception e)
{
baconMan.TelemetryMan.ReportUnExpectedEvent("MisHelper", "failed to send comment", e);
baconMan.TelemetryMan.ReportUnexpectedEvent("MisHelper", "failed to send comment", e);
baconMan.MessageMan.DebugDia("failed to send message", e);
}
return returnString;
Expand Down Expand Up @@ -215,7 +215,7 @@ public static async Task<User> GetRedditUser(BaconManager baconMan, string userN
}
catch (Exception e)
{
baconMan.TelemetryMan.ReportUnExpectedEvent("MisHelper", "failed to search for user", e);
baconMan.TelemetryMan.ReportUnexpectedEvent("MisHelper", "failed to search for user", e);
baconMan.MessageMan.DebugDia("failed to search for user", e);
}
return foundUser;
Expand Down Expand Up @@ -246,7 +246,7 @@ public static async Task<bool> DeletePost(BaconManager baconMan, string postId)
}
catch (Exception e)
{
baconMan.TelemetryMan.ReportUnExpectedEvent("MisHelper", "failed to delete post", e);
baconMan.TelemetryMan.ReportUnexpectedEvent("MisHelper", "failed to delete post", e);
baconMan.MessageMan.DebugDia("failed to delete post", e);
}
return false;
Expand Down Expand Up @@ -294,13 +294,13 @@ public static async Task<bool> SaveOrHideRedditItem(BaconManager baconMan, strin
}
else
{
baconMan.TelemetryMan.ReportUnExpectedEvent("MisHelper", "failed to save or hide item, unknown response");
baconMan.TelemetryMan.ReportUnexpectedEvent("MisHelper", "failed to save or hide item, unknown response");
baconMan.MessageMan.DebugDia("failed to save or hide item, unknown response");
}
}
catch (Exception e)
{
baconMan.TelemetryMan.ReportUnExpectedEvent("MisHelper", "failed to save or hide item", e);
baconMan.TelemetryMan.ReportUnexpectedEvent("MisHelper", "failed to save or hide item", e);
baconMan.MessageMan.DebugDia("failed to save or hide item", e);
}
return wasSuccess;
Expand Down Expand Up @@ -368,20 +368,20 @@ public static async Task<SubmitNewPostResponse> SubmitNewPost(BaconManager bacon
string enumName = Enum.GetName(typeof(SubmitNewPostErrors), i).ToLower(); ;
if (responseLower.Contains(enumName))
{
baconMan.TelemetryMan.ReportUnExpectedEvent("MisHelper", "failed to submit post; error: "+ enumName);
baconMan.TelemetryMan.ReportUnexpectedEvent("MisHelper", "failed to submit post; error: "+ enumName);
baconMan.MessageMan.DebugDia("failed to submit post; error: "+ enumName);
return new SubmitNewPostResponse() { Success = false, RedditError = (SubmitNewPostErrors)i};
}
}

baconMan.TelemetryMan.ReportUnExpectedEvent("MisHelper", "failed to submit post; unknown reddit error: ");
baconMan.TelemetryMan.ReportUnexpectedEvent("MisHelper", "failed to submit post; unknown reddit error: ");
baconMan.MessageMan.DebugDia("failed to submit post; unknown reddit error");
return new SubmitNewPostResponse() { Success = false, RedditError = SubmitNewPostErrors.UNKNOWN };
}
}
catch (Exception e)
{
baconMan.TelemetryMan.ReportUnExpectedEvent("MisHelper", "failed to submit post", e);
baconMan.TelemetryMan.ReportUnexpectedEvent("MisHelper", "failed to submit post", e);
baconMan.MessageMan.DebugDia("failed to submit post", e);
return new SubmitNewPostResponse() { Success = false };
}
Expand Down Expand Up @@ -411,7 +411,7 @@ public static string UploadImageToImgur(BaconManager baconMan, FileRandomAccessS
//}
//catch (Exception e)
//{
// baconMan.TelemetryMan.ReportUnExpectedEvent("MisHelper", "failed to submit post", e);
// baconMan.TelemetryMan.ReportUnexpectedEvent("MisHelper", "failed to submit post", e);
// baconMan.MessageMan.DebugDia("failed to submit post", e);
// return new SubmitNewPostResponse() { Success = false };
//}
Expand Down
4 changes: 2 additions & 2 deletions BaconBackend/Helpers/TrendingSubredditsHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ private void Collector_OnCollectionUpdated(object sender, OnCollectionUpdatedArg
}
catch(Exception ex)
{
m_baconMan.TelemetryMan.ReportUnExpectedEvent(this, "failedtoParseTrendingPost", ex);
m_baconMan.TelemetryMan.ReportUnexpectedEvent(this, "failedtoParseTrendingPost", ex);
m_baconMan.MessageMan.DebugDia("failed to parse trending subs post", ex);
}
}
Expand All @@ -167,7 +167,7 @@ private void FireReadyEvent(List<string> newSubreddits)
}
catch(Exception e)
{
m_baconMan.TelemetryMan.ReportUnExpectedEvent(this, "failedToFireReadyEvent", e);
m_baconMan.TelemetryMan.ReportUnexpectedEvent(this, "failedToFireReadyEvent", e);
m_baconMan.MessageMan.DebugDia("failed to fire trending subs ready event", e);
}
}
Expand Down
6 changes: 3 additions & 3 deletions BaconBackend/Managers/Background/BackgroundBandManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ public async Task UpdateInboxMessages(List<Tuple<string, string, string>> newNot
catch(Exception e)
{
m_baconMan.MessageMan.DebugDia("failed to update band message", e);
m_baconMan.TelemetryMan.ReportUnExpectedEvent(this, "FailedToUpdateBandMessages", e);
m_baconMan.TelemetryMan.ReportUnexpectedEvent(this, "FailedToUpdateBandMessages", e);
}
}
}
Expand Down Expand Up @@ -188,7 +188,7 @@ public async Task<bool> EnsureBandTileState()
if (!await bandClient.TileManager.AddTileAsync(tile))
{
m_baconMan.MessageMan.DebugDia("failed to create tile");
m_baconMan.TelemetryMan.ReportUnExpectedEvent(this, "FailedToCreateTileOnBand");
m_baconMan.TelemetryMan.ReportUnexpectedEvent(this, "FailedToCreateTileOnBand");
wasSuccess = false;
}
}
Expand All @@ -203,7 +203,7 @@ public async Task<bool> EnsureBandTileState()
if (!await bandClient.TileManager.RemoveTileAsync(baconitTile))
{
m_baconMan.MessageMan.DebugDia("failed to remove tile");
m_baconMan.TelemetryMan.ReportUnExpectedEvent(this, "FailedToRemoveTileOnBand");
m_baconMan.TelemetryMan.ReportUnexpectedEvent(this, "FailedToRemoveTileOnBand");
wasSuccess = false;
}
}
Expand Down
10 changes: 5 additions & 5 deletions BaconBackend/Managers/Background/BackgroundImageUpdater.cs
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ private async Task KickOffUpdate(bool force, RefCountedDeferral refDeferral)
catch(Exception e)
{
m_baconMan.MessageMan.DebugDia("Failed to set background image", e);
m_baconMan.TelemetryMan.ReportUnExpectedEvent(this, "Failed to set background image", e);
m_baconMan.TelemetryMan.ReportUnexpectedEvent(this, "Failed to set background image", e);
}
}

Expand Down Expand Up @@ -216,7 +216,7 @@ private async Task DoImageRotation(UpdateTypes type)
catch (Exception e)
{
m_baconMan.MessageMan.DebugDia("Failed to set background image", e);
m_baconMan.TelemetryMan.ReportUnExpectedEvent(this, "Failed to set background image", e);
m_baconMan.TelemetryMan.ReportUnexpectedEvent(this, "Failed to set background image", e);
}
}

Expand Down Expand Up @@ -286,7 +286,7 @@ private async Task<bool> DoSingleImageRotation(UpdateTypes type)
if (!wasSuccess)
{
m_baconMan.TelemetryMan.ReportLog(this, "Image update failed", SeverityLevel.Error);
m_baconMan.TelemetryMan.ReportUnExpectedEvent(this, type == UpdateTypes.LockScreen ? "LockscreenImageUpdateFailed" : "DesktopImageUpdateFailed");
m_baconMan.TelemetryMan.ReportUnexpectedEvent(this, type == UpdateTypes.LockScreen ? "LockscreenImageUpdateFailed" : "DesktopImageUpdateFailed");
}
else
{
Expand Down Expand Up @@ -460,7 +460,7 @@ private async void GetImagesFromPosts(List<Post> posts, UpdateTypes type)
}
catch(Exception e)
{
m_baconMan.TelemetryMan.ReportUnExpectedEvent(this, "FailedToDeleteCacheImages", e);
m_baconMan.TelemetryMan.ReportUnexpectedEvent(this, "FailedToDeleteCacheImages", e);
}

// Setup the vars
Expand Down Expand Up @@ -583,7 +583,7 @@ public async void OnRequestComplete(object sender, ImageManager.ImageManagerResp
catch (Exception e)
{
m_baconMan.MessageMan.DebugDia("Failed to write background image", e);
m_baconMan.TelemetryMan.ReportUnExpectedEvent(this, "Failed to write background image", e);
m_baconMan.TelemetryMan.ReportUnexpectedEvent(this, "Failed to write background image", e);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ public async void UpdateNotifications(List<Message> newMessages)
}
catch (Exception ex)
{
m_baconMan.TelemetryMan.ReportUnExpectedEvent(this, "messageUpdaterFailed", ex);
m_baconMan.TelemetryMan.ReportUnexpectedEvent(this, "messageUpdaterFailed", ex);
m_baconMan.MessageMan.DebugDia("failed to update message notifications", ex);
}

Expand Down
2 changes: 1 addition & 1 deletion BaconBackend/Managers/Background/MessageOfTheDayManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ public async Task<MessageOfTheDay> GetNewMessage()
catch(Exception e)
{
m_baconMan.MessageMan.DebugDia("failed to get motd", e);
m_baconMan.TelemetryMan.ReportUnExpectedEvent(this, "FailedToGetMotd", e);
m_baconMan.TelemetryMan.ReportUnexpectedEvent(this, "FailedToGetMotd", e);
}

return null;
Expand Down
2 changes: 1 addition & 1 deletion BaconBackend/Managers/BackgroundManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ public async Task EnsureBackgroundSetup()
}
catch(Exception e)
{
m_baconMan.TelemetryMan.ReportUnExpectedEvent(this, "failed to register background task", e);
m_baconMan.TelemetryMan.ReportUnexpectedEvent(this, "failed to register background task", e);
m_baconMan.MessageMan.DebugDia("failed to register background task", e);
}
}
Expand Down
4 changes: 2 additions & 2 deletions BaconBackend/Managers/DraftManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ public async Task<bool> SavePostSubmissionDraft(PostSubmissionDraftData data)
catch(Exception e)
{
m_baconMan.MessageMan.DebugDia("failed to write draft", e);
m_baconMan.TelemetryMan.ReportUnExpectedEvent(this, "FailedToWriteDraftFile",e);
m_baconMan.TelemetryMan.ReportUnexpectedEvent(this, "FailedToWriteDraftFile",e);
return false;
}
return true;
Expand Down Expand Up @@ -98,7 +98,7 @@ public async Task<PostSubmissionDraftData> GetPostSubmissionDraft()
catch (Exception e)
{
m_baconMan.MessageMan.DebugDia("failed to read draft", e);
m_baconMan.TelemetryMan.ReportUnExpectedEvent(this, "FailedToReadDraftFile", e);
m_baconMan.TelemetryMan.ReportUnexpectedEvent(this, "FailedToReadDraftFile", e);
return null;
}
}
Expand Down
4 changes: 2 additions & 2 deletions BaconBackend/Managers/ImageManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -321,15 +321,15 @@ public void SaveImageLocally(string postUrl)
}
catch(Exception ex)
{
m_baconMan.TelemetryMan.ReportUnExpectedEvent(this, "FailedToSaveImageLocallyCallback", ex);
m_baconMan.TelemetryMan.ReportUnexpectedEvent(this, "FailedToSaveImageLocallyCallback", ex);
m_baconMan.MessageMan.DebugDia("failed to save image locally in callback", ex);
}
};
QueueImageRequest(request);
}
catch (Exception e)
{
m_baconMan.TelemetryMan.ReportUnExpectedEvent(this, "FailedToSaveImageLocally", e);
m_baconMan.TelemetryMan.ReportUnexpectedEvent(this, "FailedToSaveImageLocally", e);
m_baconMan.MessageMan.DebugDia("failed to save image locally", e);
}
}
Expand Down
4 changes: 2 additions & 2 deletions BaconBackend/Managers/MemoryManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,7 @@ public void FireMemoryReport(ulong usedMemory, ulong memoryLimit, double usedPer
catch(Exception e)
{
m_baconMan.MessageMan.DebugDia("Memory report fire failed", e);
m_baconMan.TelemetryMan.ReportUnExpectedEvent(this, "MemeoryReportFiredFailed", e);
m_baconMan.TelemetryMan.ReportUnexpectedEvent(this, "MemeoryReportFiredFailed", e);
}
}

Expand All @@ -309,7 +309,7 @@ public void FireMemoryCleanup(MemoryPressureStates current, MemoryPressureStates
catch (Exception e)
{
m_baconMan.MessageMan.DebugDia("Memory cleanup fire failed", e);
m_baconMan.TelemetryMan.ReportUnExpectedEvent(this, "MemeoryCleanupFiredFailed", e);
m_baconMan.TelemetryMan.ReportUnexpectedEvent(this, "MemeoryCleanupFiredFailed", e);
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions BaconBackend/Managers/MessageManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ await Windows.ApplicationModel.Core.CoreApplication.MainView.CoreWindow.Dispatch
}
catch (Exception e)
{
m_baconMan.TelemetryMan.ReportUnExpectedEvent(this, "FailedToShowMessage", e);
m_baconMan.TelemetryMan.ReportUnexpectedEvent(this, "FailedToShowMessage", e);
}
});
}
Expand Down Expand Up @@ -83,7 +83,7 @@ await Windows.ApplicationModel.Core.CoreApplication.MainView.CoreWindow.Dispatch
}
catch(Exception e)
{
m_baconMan.TelemetryMan.ReportUnExpectedEvent(this, "FailedToShowMessage",e);
m_baconMan.TelemetryMan.ReportUnexpectedEvent(this, "FailedToShowMessage",e);
}
});
}
Expand Down
2 changes: 1 addition & 1 deletion BaconBackend/Managers/SettingsManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ public void WriteToLocalSettings<T>(string name, T obj)
catch(Exception e)
{
m_baconMan.MessageMan.DebugDia("failed to write setting " + name, e);
m_baconMan.TelemetryMan.ReportUnExpectedEvent(this, "failedToWriteSetting" + name, e);
m_baconMan.TelemetryMan.ReportUnexpectedEvent(this, "failedToWriteSetting" + name, e);
}
}

Expand Down
6 changes: 3 additions & 3 deletions BaconBackend/Managers/SubredditManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ public async Task<Subreddit> GetSubredditFromWebByDisplayName(string displayName
}
catch (Exception e)
{
m_baconMan.TelemetryMan.ReportUnExpectedEvent(this, "failed to get subreddit", e);
m_baconMan.TelemetryMan.ReportUnexpectedEvent(this, "failed to get subreddit", e);
m_baconMan.MessageMan.DebugDia("failed to get subreddit", e);
}

Expand Down Expand Up @@ -257,13 +257,13 @@ public async Task<bool> ChangeSubscriptionStatus(string subredditId, bool subscr
}

// Report the error
m_baconMan.TelemetryMan.ReportUnExpectedEvent(this, "FailedToSubscribeToSubredditWebRequestFailed");
m_baconMan.TelemetryMan.ReportUnexpectedEvent(this, "FailedToSubscribeToSubredditWebRequestFailed");
m_baconMan.MessageMan.DebugDia("failed to subscribe / unsub subreddit, reddit returned an expected value");
return false;
}
catch (Exception e)
{
m_baconMan.TelemetryMan.ReportUnExpectedEvent(this, "FailedToSubscribeToSubreddit", e);
m_baconMan.TelemetryMan.ReportUnexpectedEvent(this, "FailedToSubscribeToSubreddit", e);
m_baconMan.MessageMan.DebugDia("failed to subscribe / unsub subreddit", e);
}
return false;
Expand Down
2 changes: 1 addition & 1 deletion BaconBackend/Managers/TelemetryManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public void ReportEvent(object component, string eventName, string data)
/// Reports an event that might need to be looked at, an unexpected event.
/// </summary>
/// <param name="eventName"></param>
public void ReportUnExpectedEvent(object component, string eventName, Exception excpetion = null)
public void ReportUnexpectedEvent(object component, string eventName, Exception excpetion = null)
{
TelemetryClient client = new TelemetryClient();
EventTelemetry eventT = new EventTelemetry();
Expand Down
Loading