This commit is contained in:
@@ -1,18 +1,22 @@
|
||||
/* xeslint-disable */
|
||||
let lastMessageHash = 0;
|
||||
let lastMessageTimeStamp = new Date();
|
||||
|
||||
////////////////////////////////////////////////////////
|
||||
//
|
||||
// translate, Log and optionally display errors
|
||||
// return translated message in case caller needs it
|
||||
function dealWithError(msg, vm) {
|
||||
//Check if this is the same message again as last time to avoid
|
||||
//repetitive loops of useless messages
|
||||
//Check if this is the same message again as last time within a short time span to avoid endless looping errors of same message
|
||||
//but still allow for user to repeat operation that causes error so they can view it
|
||||
let newHash = window.$gz.util.quickHash(msg);
|
||||
if (newHash == lastMessageHash) {
|
||||
return;
|
||||
let tsnow = new Date();
|
||||
//don't show the same exact message if it was just shown less than 1 second ago
|
||||
if (tsnow - lastMessageTimeStamp < 1000) return;
|
||||
}
|
||||
lastMessageHash = newHash;
|
||||
lastMessageTimeStamp = new Date();
|
||||
|
||||
//translate as necessary
|
||||
msg = window.$gz.translation.translateString(msg);
|
||||
|
||||
Reference in New Issue
Block a user