summaryrefslogtreecommitdiffstats
path: root/components/sync_driver/data_type_error_handler.h
blob: 174b9a8fdb89698e26f789999dd80d0550a51ca8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
// Copyright 2014 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef COMPONENTS_SYNC_DRIVER_DATA_TYPE_ERROR_HANDLER_H__
#define COMPONENTS_SYNC_DRIVER_DATA_TYPE_ERROR_HANDLER_H__

#include <string>
#include "base/location.h"

#include "sync/api/sync_error.h"
#include "sync/internal_api/public/base/model_type.h"
#include "sync/internal_api/public/util/unrecoverable_error_handler.h"

namespace sync_driver {

class DataTypeErrorHandler {
 public:
  // Call this to disable a datatype while it is running. This is usually
  // called for a runtime failure that is specific to a datatype.
  virtual void OnSingleDataTypeUnrecoverableError(
      const syncer::SyncError& error) = 0;

  // This will create a syncer::SyncError object. This will also upload
  // a breakpad call stack to crash server. A sync error usually means
  // that sync has to be disabled either for that type or completely.
  virtual syncer::SyncError CreateAndUploadError(
      const tracked_objects::Location& location,
      const std::string& message,
      syncer::ModelType type) = 0;

 protected:
  virtual ~DataTypeErrorHandler() { }
};

}  // namespace sync_driver

#endif  // COMPONENTS_SYNC_DRIVER_DATA_TYPE_ERROR_HANDLER_H__