| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "sync/internal_api/public/util/syncer_error.h" | 5 #include "components/sync/base/syncer_error.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 | 8 |
| 9 namespace syncer { | 9 namespace syncer { |
| 10 | 10 |
| 11 #define ENUM_CASE(x) case x: return #x; break; | 11 #define ENUM_CASE(x) \ |
| 12 case x: \ |
| 13 return #x; \ |
| 14 break; |
| 12 const char* GetSyncerErrorString(SyncerError value) { | 15 const char* GetSyncerErrorString(SyncerError value) { |
| 13 switch (value) { | 16 switch (value) { |
| 14 ENUM_CASE(UNSET); | 17 ENUM_CASE(UNSET); |
| 15 ENUM_CASE(CANNOT_DO_WORK); | 18 ENUM_CASE(CANNOT_DO_WORK); |
| 16 ENUM_CASE(NETWORK_CONNECTION_UNAVAILABLE); | 19 ENUM_CASE(NETWORK_CONNECTION_UNAVAILABLE); |
| 17 ENUM_CASE(NETWORK_IO_ERROR); | 20 ENUM_CASE(NETWORK_IO_ERROR); |
| 18 ENUM_CASE(SYNC_SERVER_ERROR); | 21 ENUM_CASE(SYNC_SERVER_ERROR); |
| 19 ENUM_CASE(SYNC_AUTH_ERROR); | 22 ENUM_CASE(SYNC_AUTH_ERROR); |
| 20 ENUM_CASE(SERVER_RETURN_INVALID_CREDENTIAL); | 23 ENUM_CASE(SERVER_RETURN_INVALID_CREDENTIAL); |
| 21 ENUM_CASE(SERVER_RETURN_UNKNOWN_ERROR); | 24 ENUM_CASE(SERVER_RETURN_UNKNOWN_ERROR); |
| (...skipping 11 matching lines...) Expand all Loading... |
| 33 ENUM_CASE(SERVER_MORE_TO_DOWNLOAD); | 36 ENUM_CASE(SERVER_MORE_TO_DOWNLOAD); |
| 34 ENUM_CASE(DATATYPE_TRIGGERED_RETRY); | 37 ENUM_CASE(DATATYPE_TRIGGERED_RETRY); |
| 35 ENUM_CASE(SYNCER_OK); | 38 ENUM_CASE(SYNCER_OK); |
| 36 } | 39 } |
| 37 NOTREACHED(); | 40 NOTREACHED(); |
| 38 return "INVALID"; | 41 return "INVALID"; |
| 39 } | 42 } |
| 40 #undef ENUM_CASE | 43 #undef ENUM_CASE |
| 41 | 44 |
| 42 bool SyncerErrorIsError(SyncerError error) { | 45 bool SyncerErrorIsError(SyncerError error) { |
| 43 return error != UNSET | 46 return error != UNSET && error != SYNCER_OK && |
| 44 && error != SYNCER_OK | 47 error != SERVER_MORE_TO_DOWNLOAD; |
| 45 && error != SERVER_MORE_TO_DOWNLOAD; | |
| 46 } | 48 } |
| 47 | 49 |
| 48 } // namespace syncer | 50 } // namespace syncer |
| OLD | NEW |