Fossil SCM

If the "fossil chat send" command fails, show an error message.

drh 2021-01-05 02:25 trunk
Commit e514bb5b830945ded18a942dcbdb07f8c741840b58db9ecb77dbb116cc615694
1 file changed +8
+8
--- src/chat.c
+++ src/chat.c
@@ -820,10 +820,18 @@
820820
blob_appendf(&up,"\r\n%s", zBoundary);
821821
}
822822
blob_append(&up,"--\r\n", 4);
823823
http_exchange(&up, &down, mFlags, 4, "multipart/form-data");
824824
blob_reset(&up);
825
+ if( sqlite3_strglob("{\"isError\": true,*", blob_str(&down))==0 ){
826
+ if( strstr(blob_str(&down), "not logged in")!=0 ){
827
+ fossil_print("ERROR: username and/or password is incorrect\n");
828
+ }else{
829
+ fossil_print("ERROR: %s\n", blob_str(&down));
830
+ }
831
+ fossil_fatal("unable to send the chat message");
832
+ }
825833
blob_reset(&down);
826834
}else if( strcmp(g.argv[2],"url")==0 ){
827835
/* Undocumented command. Show the URL to access chat. */
828836
fossil_print("%s/chat\n", zUrl);
829837
}else{
830838
--- src/chat.c
+++ src/chat.c
@@ -820,10 +820,18 @@
820 blob_appendf(&up,"\r\n%s", zBoundary);
821 }
822 blob_append(&up,"--\r\n", 4);
823 http_exchange(&up, &down, mFlags, 4, "multipart/form-data");
824 blob_reset(&up);
 
 
 
 
 
 
 
 
825 blob_reset(&down);
826 }else if( strcmp(g.argv[2],"url")==0 ){
827 /* Undocumented command. Show the URL to access chat. */
828 fossil_print("%s/chat\n", zUrl);
829 }else{
830
--- src/chat.c
+++ src/chat.c
@@ -820,10 +820,18 @@
820 blob_appendf(&up,"\r\n%s", zBoundary);
821 }
822 blob_append(&up,"--\r\n", 4);
823 http_exchange(&up, &down, mFlags, 4, "multipart/form-data");
824 blob_reset(&up);
825 if( sqlite3_strglob("{\"isError\": true,*", blob_str(&down))==0 ){
826 if( strstr(blob_str(&down), "not logged in")!=0 ){
827 fossil_print("ERROR: username and/or password is incorrect\n");
828 }else{
829 fossil_print("ERROR: %s\n", blob_str(&down));
830 }
831 fossil_fatal("unable to send the chat message");
832 }
833 blob_reset(&down);
834 }else if( strcmp(g.argv[2],"url")==0 ){
835 /* Undocumented command. Show the URL to access chat. */
836 fossil_print("%s/chat\n", zUrl);
837 }else{
838

Keyboard Shortcuts

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