Fossil SCM
After any kind of database error, include in the error message a warning to the user that it might be wise to run "fossil all rebuild".
Commit
397fa9bf785aec6dfbcdfb812d9ae2a3848cbaf9
Parent
db608ee72f27666…
1 file changed
+6
-2
M
src/db.c
+6
-2
| --- src/db.c | ||
| +++ src/db.c | ||
| @@ -63,10 +63,14 @@ | ||
| 63 | 63 | ** Call this routine when a database error occurs. |
| 64 | 64 | */ |
| 65 | 65 | static void db_err(const char *zFormat, ...){ |
| 66 | 66 | va_list ap; |
| 67 | 67 | char *z; |
| 68 | + static const char zRebuildMsg[] = | |
| 69 | + "If you have recently updated your fossil executable, you might\n" | |
| 70 | + "need to run \"fossil all rebuild\" to bring the repository\n" | |
| 71 | + "schemas up to date.\n"; | |
| 68 | 72 | va_start(ap, zFormat); |
| 69 | 73 | z = vmprintf(zFormat, ap); |
| 70 | 74 | va_end(ap); |
| 71 | 75 | if( g.xferPanic ){ |
| 72 | 76 | cgi_reset_content(); |
| @@ -74,14 +78,14 @@ | ||
| 74 | 78 | cgi_reply(); |
| 75 | 79 | } |
| 76 | 80 | if( g.cgiPanic ){ |
| 77 | 81 | g.cgiPanic = 0; |
| 78 | 82 | cgi_printf("<h1>Database Error</h1>\n" |
| 79 | - "<pre>%h</pre>", z); | |
| 83 | + "<pre>%h</pre><p>%s</p>", z, zRebuildMsg); | |
| 80 | 84 | cgi_reply(); |
| 81 | 85 | }else{ |
| 82 | - fprintf(stderr, "%s: %s\n", g.argv[0], z); | |
| 86 | + fprintf(stderr, "%s: %s\n\n%s", g.argv[0], z, zRebuildMsg); | |
| 83 | 87 | } |
| 84 | 88 | db_force_rollback(); |
| 85 | 89 | exit(1); |
| 86 | 90 | } |
| 87 | 91 | |
| 88 | 92 |
| --- src/db.c | |
| +++ src/db.c | |
| @@ -63,10 +63,14 @@ | |
| 63 | ** Call this routine when a database error occurs. |
| 64 | */ |
| 65 | static void db_err(const char *zFormat, ...){ |
| 66 | va_list ap; |
| 67 | char *z; |
| 68 | va_start(ap, zFormat); |
| 69 | z = vmprintf(zFormat, ap); |
| 70 | va_end(ap); |
| 71 | if( g.xferPanic ){ |
| 72 | cgi_reset_content(); |
| @@ -74,14 +78,14 @@ | |
| 74 | cgi_reply(); |
| 75 | } |
| 76 | if( g.cgiPanic ){ |
| 77 | g.cgiPanic = 0; |
| 78 | cgi_printf("<h1>Database Error</h1>\n" |
| 79 | "<pre>%h</pre>", z); |
| 80 | cgi_reply(); |
| 81 | }else{ |
| 82 | fprintf(stderr, "%s: %s\n", g.argv[0], z); |
| 83 | } |
| 84 | db_force_rollback(); |
| 85 | exit(1); |
| 86 | } |
| 87 | |
| 88 |
| --- src/db.c | |
| +++ src/db.c | |
| @@ -63,10 +63,14 @@ | |
| 63 | ** Call this routine when a database error occurs. |
| 64 | */ |
| 65 | static void db_err(const char *zFormat, ...){ |
| 66 | va_list ap; |
| 67 | char *z; |
| 68 | static const char zRebuildMsg[] = |
| 69 | "If you have recently updated your fossil executable, you might\n" |
| 70 | "need to run \"fossil all rebuild\" to bring the repository\n" |
| 71 | "schemas up to date.\n"; |
| 72 | va_start(ap, zFormat); |
| 73 | z = vmprintf(zFormat, ap); |
| 74 | va_end(ap); |
| 75 | if( g.xferPanic ){ |
| 76 | cgi_reset_content(); |
| @@ -74,14 +78,14 @@ | |
| 78 | cgi_reply(); |
| 79 | } |
| 80 | if( g.cgiPanic ){ |
| 81 | g.cgiPanic = 0; |
| 82 | cgi_printf("<h1>Database Error</h1>\n" |
| 83 | "<pre>%h</pre><p>%s</p>", z, zRebuildMsg); |
| 84 | cgi_reply(); |
| 85 | }else{ |
| 86 | fprintf(stderr, "%s: %s\n\n%s", g.argv[0], z, zRebuildMsg); |
| 87 | } |
| 88 | db_force_rollback(); |
| 89 | exit(1); |
| 90 | } |
| 91 | |
| 92 |