OLD | NEW |
---|---|
(Empty) | |
1 // Copyright (c) 2011 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 | |
5 #include "chrome/browser/sync/api/sync_error.h" | |
6 | |
7 #include "base/logging.h" | |
8 | |
9 SyncError::SyncError() { | |
10 } | |
11 | |
12 SyncError::SyncError(const tracked_objects::Location& location, | |
13 const std::string& message, | |
14 syncable::ModelType type) | |
15 : location_(new tracked_objects::Location(location)), | |
16 message_(message), | |
17 type_(type) { | |
18 print_log_error(); | |
19 } | |
20 | |
21 SyncError::SyncError(const SyncError& rhs) { | |
22 location_.reset(new tracked_objects::Location(rhs.location())); | |
23 message_ = rhs.message(); | |
24 type_ = rhs.type(); | |
25 } | |
26 | |
27 void SyncError::Reset(const tracked_objects::Location& location, | |
28 const std::string& message, | |
29 syncable::ModelType type) { | |
30 location_.reset(new tracked_objects::Location(location)); | |
31 message_ = message; | |
32 type_ = type; | |
33 print_log_error(); | |
34 } | |
35 | |
36 bool SyncError::IsInitialized() const { | |
37 return location_.get() != NULL; | |
38 } | |
39 | |
40 const tracked_objects::Location& SyncError::location() const { | |
41 CHECK(IsInitialized()); | |
42 return *location_; | |
43 } | |
44 | |
45 const std::string& SyncError::message() const { | |
46 DCHECK(IsInitialized()); | |
akalin
2011/07/21 23:03:53
should probably be a CHECK, too, for consistency
Nicolas Zea
2011/07/21 23:43:26
Done.
| |
47 return message_; | |
48 } | |
49 | |
50 const syncable::ModelType SyncError::type() const { | |
51 DCHECK(IsInitialized()); | |
akalin
2011/07/21 23:03:53
here too
Nicolas Zea
2011/07/21 23:43:26
Done.
| |
52 return type_; | |
53 } | |
54 | |
55 void SyncError::print_log_error() const { | |
56 LAZY_STREAM(logging::LogMessage(location_->file_name(), | |
57 location_->line_number(), | |
58 ERROR).stream(), | |
akalin
2011/07/21 23:03:53
how does this work? I think you need to do loggin
Nicolas Zea
2011/07/21 23:43:26
ERROR is a macro from logging.h that turns into 0.
| |
59 LOG_IS_ON(ERROR)) | |
60 << syncable::ModelTypeToString(type_) << " Sync Error: " << message_; | |
61 } | |
OLD | NEW |