mirror of
https://github.com/nextcloud/desktop.git
synced 2024-10-24 13:25:52 +03:00
csync_statedb: Have more granular error reporting when the loaddb fails
In order to distiguish error from sqlite_open or from the integrity check Issue #2673
This commit is contained in:
parent
f654c53c35
commit
08d3ae9f02
4 changed files with 6 additions and 5 deletions
|
@ -210,7 +210,6 @@ int csync_update(CSYNC *ctx) {
|
|||
CSYNC_LOG(CSYNC_LOG_PRIORITY_DEBUG, "Journal: %s", ctx->statedb.file);
|
||||
|
||||
if (csync_statedb_load(ctx, ctx->statedb.file, &ctx->statedb.db) < 0) {
|
||||
ctx->status_code = CSYNC_STATUS_STATEDB_LOAD_ERROR;
|
||||
rc = -1;
|
||||
return rc;
|
||||
}
|
||||
|
@ -287,7 +286,6 @@ int csync_reconcile(CSYNC *ctx) {
|
|||
csync_gettime(&start);
|
||||
|
||||
if (csync_statedb_load(ctx, ctx->statedb.file, &ctx->statedb.db) < 0) {
|
||||
ctx->status_code = CSYNC_STATUS_STATEDB_LOAD_ERROR;
|
||||
rc = -1;
|
||||
return rc;
|
||||
}
|
||||
|
|
|
@ -56,7 +56,7 @@ enum csync_status_codes_e {
|
|||
CSYNC_STATUS_UNSUCCESSFUL,
|
||||
CSYNC_STATUS_NO_LOCK, /* OBSOLETE does not happen anymore */
|
||||
CSYNC_STATUS_STATEDB_LOAD_ERROR,
|
||||
CSYNC_STATUS_STATEDB_WRITE_ERROR,
|
||||
CSYNC_STATUS_STATEDB_CORRUPTED,
|
||||
CSYNC_STATUS_NO_MODULE,
|
||||
CSYNC_STATUS_TIMESKEW,
|
||||
CSYNC_STATUS_FILESYSTEM_UNKNOWN,
|
||||
|
|
|
@ -131,6 +131,7 @@ int csync_statedb_load(CSYNC *ctx, const char *statedb, sqlite3 **pdb) {
|
|||
|
||||
if (ctx->statedb.db) {
|
||||
CSYNC_LOG(CSYNC_LOG_PRIORITY_NOTICE, "ERR: DB already open");
|
||||
ctx->status_code = CSYNC_STATUS_PARAM_ERROR;
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -143,6 +144,7 @@ int csync_statedb_load(CSYNC *ctx, const char *statedb, sqlite3 **pdb) {
|
|||
errmsg ? errmsg : "<no sqlite3 errormsg>");
|
||||
|
||||
rc = -1;
|
||||
ctx->status_code = CSYNC_STATUS_STATEDB_LOAD_ERROR;
|
||||
goto out;
|
||||
}
|
||||
|
||||
|
@ -151,6 +153,7 @@ int csync_statedb_load(CSYNC *ctx, const char *statedb, sqlite3 **pdb) {
|
|||
CSYNC_LOG(CSYNC_LOG_PRIORITY_NOTICE, "ERR: sqlite3 integrity check failed - bail out: %s.",
|
||||
errmsg ? errmsg : "<no sqlite3 errormsg>");
|
||||
rc = -1;
|
||||
ctx->status_code = CSYNC_STATUS_STATEDB_CORRUPTED;
|
||||
goto out;
|
||||
}
|
||||
|
||||
|
|
|
@ -98,8 +98,8 @@ QString SyncEngine::csyncErrorToString(CSYNC_STATUS err)
|
|||
errStr = tr("CSync failed to load or create the journal file. "
|
||||
"Make sure you have read and write permissions in the local sync directory.");
|
||||
break;
|
||||
case CSYNC_STATUS_STATEDB_WRITE_ERROR:
|
||||
errStr = tr("CSync failed to write the journal file.");
|
||||
case CSYNC_STATUS_STATEDB_CORRUPTED:
|
||||
errStr = tr("CSync failed to load the journal file. The journal file is corrupted.");
|
||||
break;
|
||||
case CSYNC_STATUS_NO_MODULE:
|
||||
errStr = tr("<p>The %1 plugin for csync could not be loaded.<br/>Please verify the installation!</p>").arg(Theme::instance()->appNameGUI());
|
||||
|
|
Loading…
Reference in a new issue