mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-03-13 04:00:21 +00:00
Better error reporting for failed save on BPE
This commit is contained in:
@@ -271,7 +271,12 @@ angular.module("ofn.admin").controller "AdminProductEditCtrl", [
|
||||
$scope.updateVariantLists(data.products)
|
||||
$timeout -> $scope.displaySuccess()
|
||||
).error (data, status) ->
|
||||
$scope.displayFailure "Server returned with error status: " + status
|
||||
if status == 400 && data.errors? && data.errors.length > 0
|
||||
errors = error + "\n" for error in data.errors
|
||||
alert "Saving failed with the following error(s):\n" + errors
|
||||
$scope.displayFailure "Save failed due to invalid data"
|
||||
else
|
||||
$scope.displayFailure "Server returned with error status: " + status
|
||||
|
||||
|
||||
$scope.packProduct = (product) ->
|
||||
@@ -336,7 +341,7 @@ angular.module("ofn.admin").controller "AdminProductEditCtrl", [
|
||||
$scope.displayFailure = (failMessage) ->
|
||||
$scope.setMessage $scope.updateStatusMessage, "Saving failed. " + failMessage,
|
||||
color: "#DA5354"
|
||||
, 10000
|
||||
, false
|
||||
|
||||
|
||||
$scope.displayDirtyProducts = ->
|
||||
|
||||
Reference in New Issue
Block a user