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);
|
||||
|
||||
@@ -27,7 +27,10 @@ export default {
|
||||
msg,
|
||||
helpUrl
|
||||
) {
|
||||
//log full message
|
||||
window.$gz.store.commit("logItem", "notify-error: " + msg);
|
||||
//trim really long message as it's likely useless beyond the first few lines (stack trace etc)
|
||||
msg = msg.substring(0, 600);
|
||||
vm.$root.$gznotify({
|
||||
message: msg,
|
||||
type: "error",
|
||||
|
||||
Reference in New Issue
Block a user