-
Notifications
You must be signed in to change notification settings - Fork 226
Added logs and handle CompletableFutures exception #1600
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,6 +1,7 @@ | ||
| package org.mozilla.vrbrowser.search.suggestions; | ||
|
|
||
| import android.content.Context; | ||
| import android.util.Log; | ||
|
|
||
| import androidx.annotation.NonNull; | ||
|
|
||
|
|
@@ -17,6 +18,8 @@ | |
|
|
||
| public class SuggestionsProvider { | ||
|
|
||
| private static final String LOGTAG = SuggestionsProvider.class.getSimpleName(); | ||
|
|
||
| public class DefaultSuggestionsComparator implements Comparator { | ||
|
|
||
| public int compare(Object obj1, Object obj2) { | ||
|
|
@@ -90,6 +93,11 @@ public CompletableFuture<List<SuggestionItem>> getBookmarkSuggestions(@NonNull L | |
| items.sort(mComparator); | ||
| } | ||
| future.complete(items); | ||
|
|
||
| }).exceptionally(th -> { | ||
| Log.e(LOGTAG, "Error getting bookmarks suggestions: " + th.getLocalizedMessage()); | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I assume the exceptions do not contain PII? I'm paranoid after all the work it took to clean up FxR.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Being part of AC I guess they don't, maybe @pocmo can answer that.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I would hope not but since these API deal with bookmarks and history I could conceive of something get leaked out.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Since this calls into Kotlin and Rust code of AS libraries we can't really guarantee that at the AC level.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @keianhzo we should probably make the Logs debug then so they get stripped out for release? |
||
| future.complete(items); | ||
| return null; | ||
| }); | ||
|
|
||
| return future; | ||
|
|
@@ -111,6 +119,11 @@ public CompletableFuture<List<SuggestionItem>> getHistorySuggestions(@NonNull fi | |
| items.sort(mComparator); | ||
| } | ||
| future.complete(items); | ||
|
|
||
| }).exceptionally(th -> { | ||
| Log.e(LOGTAG, "Error getting history suggestions: " + th.getLocalizedMessage()); | ||
| future.complete(items); | ||
| return null; | ||
| }); | ||
|
|
||
| return future; | ||
|
|
@@ -152,6 +165,11 @@ public CompletableFuture<List<SuggestionItem>> getSearchEngineSuggestions(@NonNu | |
| items.sort(mComparator); | ||
| } | ||
| future.complete(items); | ||
|
|
||
| }).exceptionally(th -> { | ||
| Log.e(LOGTAG, "Error getting search engine suggestions: " + th.getLocalizedMessage()); | ||
| future.complete(items); | ||
| return null; | ||
| }); | ||
|
|
||
| return future; | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.