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 #include "sql/error_delegate_util.h"
7 #include "third_party/sqlite/sqlite3.h"
11 bool IsErrorCatastrophic(int error
) {
15 // Theoretically, the wrapped delegate might have resolved the error, and
16 // we would end up here.
21 // Highly unlikely we would ever recover from these.
25 // TODO(erikwright): Figure out what this means.
29 // This could be broken blocks, in which case deleting the DB would be a
30 // good idea. But it might also be transient.
31 // TODO(erikwright): Figure out if we can distinguish between the two,
32 // or determine through metrics analysis to what extent these failures are
37 // Presumably transient.
43 // Not a problem with the database.
47 // Presumably either transient or we don't have the privileges to
48 // move/delete the file anyway.
51 case SQLITE_CONSTRAINT
:
53 // These probgably indicate a programming error or a migration failure
54 // that we prefer not to mask.
61 case SQLITE_INTERRUPT
:
73 // None of these appear in error reports, so for now let's not try to
74 // guess at how to handle them.