Add a constructor that takes only the "interesting" args (basically the args that...
[chromium-blink-merge.git] / sync / protocol / sync_protocol_error.h
blobf23659b503abc438fbb2dbbc7db48bb96f7054d2
1 // Copyright (c) 2012 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 SYNC_PROTOCOL_SYNC_PROTOCOL_ERROR_H_
5 #define SYNC_PROTOCOL_SYNC_PROTOCOL_ERROR_H_
7 #include <string>
9 #include "base/values.h"
10 #include "sync/internal_api/public/base/model_type.h"
12 namespace syncer{
14 enum SyncProtocolErrorType {
15 // Success case.
16 SYNC_SUCCESS,
18 // Birthday does not match that of the server.
19 NOT_MY_BIRTHDAY,
21 // Server is busy. Try later.
22 THROTTLED,
24 // Clear user data is being currently executed by the server.
25 CLEAR_PENDING,
27 // Server cannot service the request now.
28 TRANSIENT_ERROR,
30 // Server does not wish the client to retry any more until the action has
31 // been taken.
32 NON_RETRIABLE_ERROR,
34 // Indicates the datatypes have been migrated and the client should resync
35 // them to get the latest progress markers.
36 MIGRATION_DONE,
38 // Invalid Credential.
39 INVALID_CREDENTIAL,
41 // The default value.
42 UNKNOWN_ERROR
45 enum ClientAction {
46 // Upgrade the client to latest version.
47 UPGRADE_CLIENT,
49 // Clear user data and setup sync again.
50 CLEAR_USER_DATA_AND_RESYNC,
52 // Set the bit on the account to enable sync.
53 ENABLE_SYNC_ON_ACCOUNT,
55 // Stop sync and restart sync.
56 STOP_AND_RESTART_SYNC,
58 // Wipe this client of any sync data.
59 DISABLE_SYNC_ON_CLIENT,
61 // The default. No action.
62 UNKNOWN_ACTION
65 struct SyncProtocolError {
66 SyncProtocolErrorType error_type;
67 std::string error_description;
68 std::string url;
69 ClientAction action;
70 ModelTypeSet error_data_types;
71 SyncProtocolError();
72 ~SyncProtocolError();
73 DictionaryValue* ToValue() const;
76 const char* GetSyncErrorTypeString(SyncProtocolErrorType type);
77 const char* GetClientActionString(ClientAction action);
78 } // namespace syncer
79 #endif // SYNC_PROTOCOL_SYNC_PROTOCOL_ERROR_H_