diff --git a/localization/de.php b/localization/de.php
index 77e34f47..afa61780 100644
--- a/localization/de.php
+++ b/localization/de.php
@@ -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)?',
'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',
+ '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
'manually' => 'Manuell',
diff --git a/public/js/grocy.js b/public/js/grocy.js
index ee185c78..7abe16fd 100644
--- a/public/js/grocy.js
+++ b/public/js/grocy.js
@@ -168,3 +168,18 @@ Grocy.FrontendHelpers.ValidateForm = function(formId)
$(form).addClass('was-validated');
}
+
+Grocy.FrontendHelpers.ShowGenericError = function(message, exception)
+{
+ toastr.error(L(message) + '
' + L('Click to show technical details'), '', {
+ onclick: function()
+ {
+ bootbox.alert({
+ title: L('Error details'),
+ message: JSON.stringify(exception, null, 4)
+ });
+ }
+ });
+
+ console.error(exception);
+}
diff --git a/public/viewjs/batteryform.js b/public/viewjs/batteryform.js
index 87e9b864..cdcf6309 100644
--- a/public/viewjs/batteryform.js
+++ b/public/viewjs/batteryform.js
@@ -11,7 +11,7 @@
},
function(xhr)
{
- console.error(xhr);
+ Grocy.FrontendHelpers.ShowGenericError('Error while saving, probably this item already exists', xhr.response)
}
);
}
@@ -24,7 +24,7 @@
},
function(xhr)
{
- console.error(xhr);
+ Grocy.FrontendHelpers.ShowGenericError('Error while saving, probably this item already exists', xhr.response)
}
);
}
diff --git a/public/viewjs/habitform.js b/public/viewjs/habitform.js
index b844173b..ef878a01 100644
--- a/public/viewjs/habitform.js
+++ b/public/viewjs/habitform.js
@@ -11,7 +11,7 @@
},
function(xhr)
{
- console.error(xhr);
+ Grocy.FrontendHelpers.ShowGenericError('Error while saving, probably this item already exists', xhr.response)
}
);
}
@@ -24,7 +24,7 @@
},
function(xhr)
{
- console.error(xhr);
+ Grocy.FrontendHelpers.ShowGenericError('Error while saving, probably this item already exists', xhr.response)
}
);
}
diff --git a/public/viewjs/locationform.js b/public/viewjs/locationform.js
index 0ae8e7bc..a3fa6e78 100644
--- a/public/viewjs/locationform.js
+++ b/public/viewjs/locationform.js
@@ -11,7 +11,7 @@
},
function(xhr)
{
- console.error(xhr);
+ Grocy.FrontendHelpers.ShowGenericError('Error while saving, probably this item already exists', xhr.response)
}
);
}
@@ -24,7 +24,7 @@
},
function(xhr)
{
- console.error(xhr);
+ Grocy.FrontendHelpers.ShowGenericError('Error while saving, probably this item already exists', xhr.response)
}
);
}
diff --git a/public/viewjs/productform.js b/public/viewjs/productform.js
index 9d4d0d14..bfbfe320 100644
--- a/public/viewjs/productform.js
+++ b/public/viewjs/productform.js
@@ -18,7 +18,7 @@
},
function(xhr)
{
- console.error(xhr);
+ Grocy.FrontendHelpers.ShowGenericError('Error while saving, probably this item already exists', xhr.response)
}
);
}
@@ -31,7 +31,7 @@
},
function(xhr)
{
- console.error(xhr);
+ Grocy.FrontendHelpers.ShowGenericError('Error while saving, probably this item already exists', xhr.response)
}
);
}
diff --git a/public/viewjs/quantityunitform.js b/public/viewjs/quantityunitform.js
index efa859ac..853fb3fe 100644
--- a/public/viewjs/quantityunitform.js
+++ b/public/viewjs/quantityunitform.js
@@ -11,7 +11,7 @@
},
function(xhr)
{
- console.error(xhr);
+ Grocy.FrontendHelpers.ShowGenericError('Error while saving, probably this item already exists', xhr.response)
}
);
}
@@ -24,7 +24,7 @@
},
function(xhr)
{
- console.error(xhr);
+ Grocy.FrontendHelpers.ShowGenericError('Error while saving, probably this item already exists', xhr.response)
}
);
}
diff --git a/public/viewjs/recipeposform.js b/public/viewjs/recipeposform.js
index 01df2e98..b298b1fa 100644
--- a/public/viewjs/recipeposform.js
+++ b/public/viewjs/recipeposform.js
@@ -14,7 +14,7 @@
},
function(xhr)
{
- console.error(xhr);
+ Grocy.FrontendHelpers.ShowGenericError('Error while saving, probably this item already exists', xhr.response)
}
);
}
@@ -27,7 +27,7 @@
},
function(xhr)
{
- console.error(xhr);
+ Grocy.FrontendHelpers.ShowGenericError('Error while saving, probably this item already exists', xhr.response)
}
);
}