OLD | NEW |
| (Empty) |
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 | |
5 #ifndef SQL_DIAGNOSTIC_ERROR_DELEGATE_H_ | |
6 #define SQL_DIAGNOSTIC_ERROR_DELEGATE_H_ | |
7 | |
8 #include "base/logging.h" | |
9 #include "sql/connection.h" | |
10 #include "sql/error_delegate_util.h" | |
11 #include "sql/sql_export.h" | |
12 | |
13 namespace sql { | |
14 | |
15 // This class handles the exceptional sqlite errors that we might encounter | |
16 // if for example the db is corrupted. Right now we just generate a UMA | |
17 // histogram for release and an assert for debug builds. | |
18 // See error_delegate_util.h for an explanation as to why this class is a | |
19 // template. | |
20 template <class UniqueT> | |
21 class DiagnosticErrorDelegate : public ErrorDelegate { | |
22 public: | |
23 DiagnosticErrorDelegate() {} | |
24 virtual ~DiagnosticErrorDelegate() {} | |
25 | |
26 virtual int OnError(int error, Connection* connection, | |
27 Statement* stmt) { | |
28 LogAndRecordErrorInHistogram<UniqueT>(error, connection); | |
29 return error; | |
30 } | |
31 | |
32 private: | |
33 DISALLOW_COPY_AND_ASSIGN(DiagnosticErrorDelegate); | |
34 }; | |
35 | |
36 } // namespace sql | |
37 | |
38 #endif // SQL_DIAGNOSTIC_ERROR_DELEGATE_H_ | |
OLD | NEW |