| 274 | } |
| 275 | |
| 276 | void checkError(const char* context, int rc) { |
| 277 | // if (deterministicRandom()->random01() < .001) rc = SQLITE_INTERRUPT; |
| 278 | if (rc) { |
| 279 | // Our exceptions don't propagate through sqlite, so we don't know for sure if the error that caused this |
| 280 | // was an injected fault. Assume that if VFSAsyncFile caught an injected Error that it caused this error |
| 281 | // return code. |
| 282 | Error err = io_error(); |
| 283 | if (g_network->isSimulated() && VFSAsyncFile::checkInjectedError()) { |
| 284 | err = err.asInjectedFault(); |
| 285 | } |
| 286 | |
| 287 | if (db) |
| 288 | db->errCode = rc; |
| 289 | if (rc == SQLITE_NOMEM) |
| 290 | platform::outOfMemory(); // SOMEDAY: Trap out of memory errors at allocation time; check out different |
| 291 | // allocation options in sqlite |
| 292 | |
| 293 | TraceEvent(SevError, "DiskError") |
| 294 | .error(err) |
| 295 | .detail("In", context) |
| 296 | .detail("File", filename) |
| 297 | .detail("SQLiteError", sqlite3ErrStr(rc)) |
| 298 | .detail("SQLiteErrorCode", rc) |
| 299 | .GetLastError(); |
| 300 | throw err; |
| 301 | } |
| 302 | } |
| 303 | |
| 304 | void checkpoint(bool restart) { |
| 305 | int logSize = 0, checkpointCount = 0; |
no test coverage detected