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".

drh 2009-11-06 03:10 trunk
Commit 397fa9bf785aec6dfbcdfb812d9ae2a3848cbaf9
1 file changed +6 -2
+6 -2
--- src/db.c
+++ src/db.c
@@ -63,10 +63,14 @@
6363
** Call this routine when a database error occurs.
6464
*/
6565
static void db_err(const char *zFormat, ...){
6666
va_list ap;
6767
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";
6872
va_start(ap, zFormat);
6973
z = vmprintf(zFormat, ap);
7074
va_end(ap);
7175
if( g.xferPanic ){
7276
cgi_reset_content();
@@ -74,14 +78,14 @@
7478
cgi_reply();
7579
}
7680
if( g.cgiPanic ){
7781
g.cgiPanic = 0;
7882
cgi_printf("<h1>Database Error</h1>\n"
79
- "<pre>%h</pre>", z);
83
+ "<pre>%h</pre><p>%s</p>", z, zRebuildMsg);
8084
cgi_reply();
8185
}else{
82
- fprintf(stderr, "%s: %s\n", g.argv[0], z);
86
+ fprintf(stderr, "%s: %s\n\n%s", g.argv[0], z, zRebuildMsg);
8387
}
8488
db_force_rollback();
8589
exit(1);
8690
}
8791
8892
--- 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

Keyboard Shortcuts

Open search /
Next entry (timeline) j
Previous entry (timeline) k
Open focused entry Enter
Show this help ?
Toggle theme Top nav button