data_type_error_handler.h 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. // Copyright 2014 The Chromium Authors. All rights reserved.
  2. // Use of this source code is governed by a BSD-style license that can be
  3. // found in the LICENSE file.
  4. #ifndef COMPONENTS_SYNC_MODEL_DATA_TYPE_ERROR_HANDLER_H__
  5. #define COMPONENTS_SYNC_MODEL_DATA_TYPE_ERROR_HANDLER_H__
  6. #include <memory>
  7. #include <string>
  8. #include "base/location.h"
  9. #include "components/sync/base/model_type.h"
  10. #include "components/sync/model/sync_error.h"
  11. namespace syncer {
  12. class DataTypeErrorHandler {
  13. public:
  14. virtual ~DataTypeErrorHandler() {}
  15. // Call this to disable a datatype while it is running. This is usually
  16. // called for a runtime failure that is specific to a datatype.
  17. virtual void OnUnrecoverableError(const SyncError& error) = 0;
  18. // This will create a SyncError object. This will also upload a breakpad call
  19. // stack to crash server. A sync error usually means that sync has to be
  20. // disabled either for that type or completely.
  21. virtual SyncError CreateAndUploadError(const base::Location& location,
  22. const std::string& message,
  23. ModelType type) = 0;
  24. // Create a copy of this error handler.
  25. virtual std::unique_ptr<DataTypeErrorHandler> Copy() const = 0;
  26. };
  27. } // namespace syncer
  28. #endif // COMPONENTS_SYNC_MODEL_DATA_TYPE_ERROR_HANDLER_H__