Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(565)

Unified Diff: chrome/browser/extensions/extension_sync_data.cc

Issue 947673002: Get more useful LOG(FATAL) messages from ExtensionSyncData to help diagnose crashes. (Closed) Base URL: https://chromium.googlesource.com/chromium/src@master
Patch Set: stringprintf Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/extensions/extension_sync_data.cc
diff --git a/chrome/browser/extensions/extension_sync_data.cc b/chrome/browser/extensions/extension_sync_data.cc
index 007887d2ce38b3f50a689ff63750eb6080379640..31df101642edf351192b45e09a965aed685d0941 100644
--- a/chrome/browser/extensions/extension_sync_data.cc
+++ b/chrome/browser/extensions/extension_sync_data.cc
@@ -5,6 +5,7 @@
#include "chrome/browser/extensions/extension_sync_data.h"
#include "base/logging.h"
+#include "base/strings/stringprintf.h"
#include "chrome/browser/extensions/app_sync_data.h"
#include "chrome/browser/extensions/extension_service.h"
#include "components/crx_file/id_util.h"
@@ -16,6 +17,18 @@
namespace extensions {
+namespace {
+
+std::string GetExtensionSpecificsLogMessage(
+ const sync_pb::ExtensionSpecifics& specifics) {
+ return base::StringPrintf("id: %s\nversion: %s\nupdate_url: %s",
+ specifics.id().c_str(),
+ specifics.version().c_str(),
+ specifics.update_url().c_str());
+}
+
+} // namespace
+
ExtensionSyncData::ExtensionSyncData()
: uninstalled_(false),
enabled_(false),
@@ -96,17 +109,21 @@ void ExtensionSyncData::PopulateExtensionSpecifics(
void ExtensionSyncData::PopulateFromExtensionSpecifics(
const sync_pb::ExtensionSpecifics& specifics) {
if (!crx_file::id_util::IdIsValid(specifics.id())) {
- LOG(FATAL) << "Attempt to sync bad ExtensionSpecifics.";
+ LOG(FATAL) << "Attempt to sync bad ExtensionSpecifics (bad ID):\n"
+ << GetExtensionSpecificsLogMessage(specifics);
}
Version specifics_version(specifics.version());
- if (!specifics_version.IsValid())
- LOG(FATAL) << "Attempt to sync bad ExtensionSpecifics.";
+ if (!specifics_version.IsValid()) {
+ LOG(FATAL) << "Attempt to sync bad ExtensionSpecifics (bad version):\n"
+ << GetExtensionSpecificsLogMessage(specifics);
+ }
// The update URL must be either empty or valid.
GURL specifics_update_url(specifics.update_url());
if (!specifics_update_url.is_empty() && !specifics_update_url.is_valid()) {
- LOG(FATAL) << "Attempt to sync bad ExtensionSpecifics.";
+ LOG(FATAL) << "Attempt to sync bad ExtensionSpecifics (bad update URL):\n"
+ << GetExtensionSpecificsLogMessage(specifics);
}
id_ = specifics.id();
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698