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.
5 #ifndef SQL_DIAGNOSTIC_ERROR_DELEGATE_H_
6 #define SQL_DIAGNOSTIC_ERROR_DELEGATE_H_
8 #include "base/logging.h"
9 #include "sql/connection.h"
10 #include "sql/error_delegate_util.h"
11 #include "sql/sql_export.h"
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
20 template <class UniqueT
>
21 class DiagnosticErrorDelegate
: public ErrorDelegate
{
23 DiagnosticErrorDelegate() {}
24 virtual ~DiagnosticErrorDelegate() {}
26 virtual int OnError(int error
, Connection
* connection
,
28 LogAndRecordErrorInHistogram
<UniqueT
>(error
, connection
);
33 DISALLOW_COPY_AND_ASSIGN(DiagnosticErrorDelegate
);
38 #endif // SQL_DIAGNOSTIC_ERROR_DELEGATE_H_