Show generic error message on saving master data (this closes #45)

This commit is contained in:
Bernd Bestel 2018-09-08 09:26:12 +02:00
parent 496594d898
commit b01b49d10c
No known key found for this signature in database
GPG Key ID: 71BD34C0D4891300
8 changed files with 29 additions and 12 deletions

View File

@ -213,6 +213,8 @@ return array(
'Are you sure to consume all ingredients needed by recipe "#1" (ingredients marked with "check only if a single unit is in stock" will be ignored)?' => 'Sicher, dass alle Zutaten die vom Rezept "#1" benötigt werden aus dem Bestand entfernt werden sollen (Zutaten markiert mit "nur prüfen, ob eine einzelne Einheit vorrätig ist" werden ignoriert)?', 'Are you sure to consume all ingredients needed by recipe "#1" (ingredients marked with "check only if a single unit is in stock" will be ignored)?' => 'Sicher, dass alle Zutaten die vom Rezept "#1" benötigt werden aus dem Bestand entfernt werden sollen (Zutaten markiert mit "nur prüfen, ob eine einzelne Einheit vorrätig ist" werden ignoriert)?',
'Removed all ingredients of recipe "#1" from stock' => 'Alle Zutaten, die vom Rezept "#1" benötigt werden, wurdem aus dem Bestand entfernt', 'Removed all ingredients of recipe "#1" from stock' => 'Alle Zutaten, die vom Rezept "#1" benötigt werden, wurdem aus dem Bestand entfernt',
'Consume all ingredients needed by this recipe' => 'Alle Zutaten, die von diesem Rezept benötigt werden, aus dem Bestand enternen', 'Consume all ingredients needed by this recipe' => 'Alle Zutaten, die von diesem Rezept benötigt werden, aus dem Bestand enternen',
'Click to show technical details' => 'Klick um technische Details anzuzeigen',
'Error while saving, probably this item already exists' => 'Fehler beim Speichern, möglicherweise existiert das Element bereits',
//Constants //Constants
'manually' => 'Manuell', 'manually' => 'Manuell',

View File

@ -168,3 +168,18 @@ Grocy.FrontendHelpers.ValidateForm = function(formId)
$(form).addClass('was-validated'); $(form).addClass('was-validated');
} }
Grocy.FrontendHelpers.ShowGenericError = function(message, exception)
{
toastr.error(L(message) + '<br><br>' + L('Click to show technical details'), '', {
onclick: function()
{
bootbox.alert({
title: L('Error details'),
message: JSON.stringify(exception, null, 4)
});
}
});
console.error(exception);
}

View File

@ -11,7 +11,7 @@
}, },
function(xhr) function(xhr)
{ {
console.error(xhr); Grocy.FrontendHelpers.ShowGenericError('Error while saving, probably this item already exists', xhr.response)
} }
); );
} }
@ -24,7 +24,7 @@
}, },
function(xhr) function(xhr)
{ {
console.error(xhr); Grocy.FrontendHelpers.ShowGenericError('Error while saving, probably this item already exists', xhr.response)
} }
); );
} }

View File

@ -11,7 +11,7 @@
}, },
function(xhr) function(xhr)
{ {
console.error(xhr); Grocy.FrontendHelpers.ShowGenericError('Error while saving, probably this item already exists', xhr.response)
} }
); );
} }
@ -24,7 +24,7 @@
}, },
function(xhr) function(xhr)
{ {
console.error(xhr); Grocy.FrontendHelpers.ShowGenericError('Error while saving, probably this item already exists', xhr.response)
} }
); );
} }

View File

@ -11,7 +11,7 @@
}, },
function(xhr) function(xhr)
{ {
console.error(xhr); Grocy.FrontendHelpers.ShowGenericError('Error while saving, probably this item already exists', xhr.response)
} }
); );
} }
@ -24,7 +24,7 @@
}, },
function(xhr) function(xhr)
{ {
console.error(xhr); Grocy.FrontendHelpers.ShowGenericError('Error while saving, probably this item already exists', xhr.response)
} }
); );
} }

View File

@ -18,7 +18,7 @@
}, },
function(xhr) function(xhr)
{ {
console.error(xhr); Grocy.FrontendHelpers.ShowGenericError('Error while saving, probably this item already exists', xhr.response)
} }
); );
} }
@ -31,7 +31,7 @@
}, },
function(xhr) function(xhr)
{ {
console.error(xhr); Grocy.FrontendHelpers.ShowGenericError('Error while saving, probably this item already exists', xhr.response)
} }
); );
} }

View File

@ -11,7 +11,7 @@
}, },
function(xhr) function(xhr)
{ {
console.error(xhr); Grocy.FrontendHelpers.ShowGenericError('Error while saving, probably this item already exists', xhr.response)
} }
); );
} }
@ -24,7 +24,7 @@
}, },
function(xhr) function(xhr)
{ {
console.error(xhr); Grocy.FrontendHelpers.ShowGenericError('Error while saving, probably this item already exists', xhr.response)
} }
); );
} }

View File

@ -14,7 +14,7 @@
}, },
function(xhr) function(xhr)
{ {
console.error(xhr); Grocy.FrontendHelpers.ShowGenericError('Error while saving, probably this item already exists', xhr.response)
} }
); );
} }
@ -27,7 +27,7 @@
}, },
function(xhr) function(xhr)
{ {
console.error(xhr); Grocy.FrontendHelpers.ShowGenericError('Error while saving, probably this item already exists', xhr.response)
} }
); );
} }