Fossil SCM

Improved error messages to background processes from the database interface.

drh 2018-07-30 19:34 UTC forum-v2
Commit 72bb00bcab1d5a24bd0e5fcad785516b70cbd7bf93973b99e4fed28a2c3580d3
1 file changed +4 -15
+4 -15
--- src/db.c
+++ src/db.c
@@ -73,11 +73,10 @@
7373
*/
7474
static void db_err(const char *zFormat, ...){
7575
static int rcLooping = 0;
7676
va_list ap;
7777
char *z;
78
- int rc = 1;
7978
if( rcLooping ) exit(rcLooping);
8079
va_start(ap, zFormat);
8180
z = vmprintf(zFormat, ap);
8281
va_end(ap);
8382
#ifdef FOSSIL_ENABLE_JSON
@@ -87,26 +86,16 @@
8786
rc = 0 /* avoid HTTP 500 */;
8887
}
8988
}
9089
else
9190
#endif /* FOSSIL_ENABLE_JSON */
92
- if( g.xferPanic ){
91
+ if( g.xferPanic && g.cgiOutput==1 ){
9392
cgi_reset_content();
9493
@ error Database\serror:\s%F(z)
95
- cgi_reply();
96
- }
97
- else if( g.cgiOutput ){
98
- g.cgiOutput = 0;
99
- cgi_printf("<h1>Database Error</h1>\n<p>%h</p>\n", z);
100
- cgi_reply();
101
- }else{
102
- fprintf(stderr, "%s: %s\n", g.argv[0], z);
103
- }
104
- free(z);
105
- rcLooping = rc;
106
- db_force_rollback();
107
- fossil_exit(rc);
94
+ cgi_reply();
95
+ }
96
+ fossil_panic("Database error: %s", z);
10897
}
10998
11099
/*
111100
** All static variable that a used by only this file are gathered into
112101
** the following structure.
113102
--- src/db.c
+++ src/db.c
@@ -73,11 +73,10 @@
73 */
74 static void db_err(const char *zFormat, ...){
75 static int rcLooping = 0;
76 va_list ap;
77 char *z;
78 int rc = 1;
79 if( rcLooping ) exit(rcLooping);
80 va_start(ap, zFormat);
81 z = vmprintf(zFormat, ap);
82 va_end(ap);
83 #ifdef FOSSIL_ENABLE_JSON
@@ -87,26 +86,16 @@
87 rc = 0 /* avoid HTTP 500 */;
88 }
89 }
90 else
91 #endif /* FOSSIL_ENABLE_JSON */
92 if( g.xferPanic ){
93 cgi_reset_content();
94 @ error Database\serror:\s%F(z)
95 cgi_reply();
96 }
97 else if( g.cgiOutput ){
98 g.cgiOutput = 0;
99 cgi_printf("<h1>Database Error</h1>\n<p>%h</p>\n", z);
100 cgi_reply();
101 }else{
102 fprintf(stderr, "%s: %s\n", g.argv[0], z);
103 }
104 free(z);
105 rcLooping = rc;
106 db_force_rollback();
107 fossil_exit(rc);
108 }
109
110 /*
111 ** All static variable that a used by only this file are gathered into
112 ** the following structure.
113
--- src/db.c
+++ src/db.c
@@ -73,11 +73,10 @@
73 */
74 static void db_err(const char *zFormat, ...){
75 static int rcLooping = 0;
76 va_list ap;
77 char *z;
 
78 if( rcLooping ) exit(rcLooping);
79 va_start(ap, zFormat);
80 z = vmprintf(zFormat, ap);
81 va_end(ap);
82 #ifdef FOSSIL_ENABLE_JSON
@@ -87,26 +86,16 @@
86 rc = 0 /* avoid HTTP 500 */;
87 }
88 }
89 else
90 #endif /* FOSSIL_ENABLE_JSON */
91 if( g.xferPanic && g.cgiOutput==1 ){
92 cgi_reset_content();
93 @ error Database\serror:\s%F(z)
94 cgi_reply();
95 }
96 fossil_panic("Database error: %s", z);
 
 
 
 
 
 
 
 
 
 
97 }
98
99 /*
100 ** All static variable that a used by only this file are gathered into
101 ** the following structure.
102

Keyboard Shortcuts

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