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 "sql/error_delegate_util.h" | 5 #include "sql/error_delegate_util.h" |
6 | 6 |
| 7 #include "base/strings/stringprintf.h" |
7 #include "third_party/sqlite/sqlite3.h" | 8 #include "third_party/sqlite/sqlite3.h" |
8 | 9 |
9 namespace sql { | 10 namespace sql { |
10 | 11 |
11 bool IsErrorCatastrophic(int error) { | 12 bool IsErrorCatastrophic(int error) { |
12 switch (error) { | 13 switch (error) { |
13 case SQLITE_DONE: | 14 case SQLITE_DONE: |
14 case SQLITE_OK: | 15 case SQLITE_OK: |
15 // Theoretically, the wrapped delegate might have resolved the error, and | 16 // Theoretically, the wrapped delegate might have resolved the error, and |
16 // we would end up here. | 17 // we would end up here. |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
70 case SQLITE_FORMAT: | 71 case SQLITE_FORMAT: |
71 case SQLITE_RANGE: | 72 case SQLITE_RANGE: |
72 case SQLITE_ROW: | 73 case SQLITE_ROW: |
73 // None of these appear in error reports, so for now let's not try to | 74 // None of these appear in error reports, so for now let's not try to |
74 // guess at how to handle them. | 75 // guess at how to handle them. |
75 return false; | 76 return false; |
76 } | 77 } |
77 return false; | 78 return false; |
78 } | 79 } |
79 | 80 |
| 81 void AppendCorruptFileInfoToDiagnostics( |
| 82 const base::FilePath& corrupted_file_path, |
| 83 std::string* diagnostics) { |
| 84 DCHECK(diagnostics); |
| 85 |
| 86 const std::string corrupted_file_name = |
| 87 corrupted_file_path.DirName().BaseName().AsUTF8Unsafe() + "/" + |
| 88 corrupted_file_path.BaseName().AsUTF8Unsafe(); |
| 89 base::StringAppendF(diagnostics, "Corrupted file: %s\n", |
| 90 corrupted_file_name.c_str()); |
| 91 } |
| 92 |
80 } // namespace sql | 93 } // namespace sql |
OLD | NEW |