Fossil SCM

Squelch /chat poll timeout errors in the dev console unless an internal debugging flag is enabled. They're an expected error case and generate lots of console log entries.

stephan 2021-06-14 09:41 trunk
Commit 1eddedeaecdfb0f0f4b0287bc26fe32c9fad183c653fb3cb09a91f1f87fa7879
1 file changed +6 -4
+6 -4
--- src/chat.js
+++ src/chat.js
@@ -94,10 +94,12 @@
9494
return resized;
9595
})();
9696
fossil.FRK = ForceResizeKludge/*for debugging*/;
9797
const Chat = (function(){
9898
const cs = {
99
+ verboseErrors: false /* if true then certain, mostly extraneous,
100
+ error messages may be sent to the console. */,
99101
e:{/*map of certain DOM elements.*/
100102
messageInjectPoint: E1('#message-inject-point'),
101103
pageTitle: E1('head title'),
102104
loadOlderToolbar: undefined /* the load-posts toolbar (dynamically created) */,
103105
inputWrapper: E1("#chat-input-area"),
@@ -226,13 +228,13 @@
226228
}else{
227229
eMsg.scrollIntoView(false);
228230
}
229231
return this;
230232
},
231
- /* Injects element e as a new row in the chat, at the oldest end
232
- of the list if atEnd is truthy, else at the newest end of the
233
- list. */
233
+ /* Injects DOM element e as a new row in the chat, at the oldest
234
+ end of the list if atEnd is truthy, else at the newest end of
235
+ the list. */
234236
injectMessageElem: function f(e, atEnd){
235237
const mip = atEnd ? this.e.loadOlderToolbar : this.e.messageInjectPoint,
236238
holder = this.e.messagesWrapper,
237239
prevMessage = this.e.newestMessage;
238240
if(atEnd){
@@ -1229,11 +1231,11 @@
12291231
// Disable the ajax start/end handling for this long-polling op:
12301232
beforesend: function(){},
12311233
aftersend: function(){},
12321234
onerror:function(err){
12331235
Chat._isBatchLoading = false;
1234
- console.error(err);
1236
+ if(Chat.verboseErrors) console.error(err);
12351237
/* ^^^ we don't use Chat.reportError() here b/c the polling
12361238
fails exepectedly when it times out, but is then immediately
12371239
resumed, and reportError() produces a loud error message. */
12381240
afterFetch();
12391241
},
12401242
--- src/chat.js
+++ src/chat.js
@@ -94,10 +94,12 @@
94 return resized;
95 })();
96 fossil.FRK = ForceResizeKludge/*for debugging*/;
97 const Chat = (function(){
98 const cs = {
 
 
99 e:{/*map of certain DOM elements.*/
100 messageInjectPoint: E1('#message-inject-point'),
101 pageTitle: E1('head title'),
102 loadOlderToolbar: undefined /* the load-posts toolbar (dynamically created) */,
103 inputWrapper: E1("#chat-input-area"),
@@ -226,13 +228,13 @@
226 }else{
227 eMsg.scrollIntoView(false);
228 }
229 return this;
230 },
231 /* Injects element e as a new row in the chat, at the oldest end
232 of the list if atEnd is truthy, else at the newest end of the
233 list. */
234 injectMessageElem: function f(e, atEnd){
235 const mip = atEnd ? this.e.loadOlderToolbar : this.e.messageInjectPoint,
236 holder = this.e.messagesWrapper,
237 prevMessage = this.e.newestMessage;
238 if(atEnd){
@@ -1229,11 +1231,11 @@
1229 // Disable the ajax start/end handling for this long-polling op:
1230 beforesend: function(){},
1231 aftersend: function(){},
1232 onerror:function(err){
1233 Chat._isBatchLoading = false;
1234 console.error(err);
1235 /* ^^^ we don't use Chat.reportError() here b/c the polling
1236 fails exepectedly when it times out, but is then immediately
1237 resumed, and reportError() produces a loud error message. */
1238 afterFetch();
1239 },
1240
--- src/chat.js
+++ src/chat.js
@@ -94,10 +94,12 @@
94 return resized;
95 })();
96 fossil.FRK = ForceResizeKludge/*for debugging*/;
97 const Chat = (function(){
98 const cs = {
99 verboseErrors: false /* if true then certain, mostly extraneous,
100 error messages may be sent to the console. */,
101 e:{/*map of certain DOM elements.*/
102 messageInjectPoint: E1('#message-inject-point'),
103 pageTitle: E1('head title'),
104 loadOlderToolbar: undefined /* the load-posts toolbar (dynamically created) */,
105 inputWrapper: E1("#chat-input-area"),
@@ -226,13 +228,13 @@
228 }else{
229 eMsg.scrollIntoView(false);
230 }
231 return this;
232 },
233 /* Injects DOM element e as a new row in the chat, at the oldest
234 end of the list if atEnd is truthy, else at the newest end of
235 the list. */
236 injectMessageElem: function f(e, atEnd){
237 const mip = atEnd ? this.e.loadOlderToolbar : this.e.messageInjectPoint,
238 holder = this.e.messagesWrapper,
239 prevMessage = this.e.newestMessage;
240 if(atEnd){
@@ -1229,11 +1231,11 @@
1231 // Disable the ajax start/end handling for this long-polling op:
1232 beforesend: function(){},
1233 aftersend: function(){},
1234 onerror:function(err){
1235 Chat._isBatchLoading = false;
1236 if(Chat.verboseErrors) console.error(err);
1237 /* ^^^ we don't use Chat.reportError() here b/c the polling
1238 fails exepectedly when it times out, but is then immediately
1239 resumed, and reportError() produces a loud error message. */
1240 afterFetch();
1241 },
1242

Keyboard Shortcuts

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