Skip to content

Commit

Permalink
Merge pull request #1064 from CruGlobal/better-error-for-bad-amount
Browse files Browse the repository at this point in the history
Display the debug message from the server
  • Loading branch information
wrandall22 authored Oct 25, 2023
2 parents a2a4fe4 + 4c50b40 commit 9c0480f
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -339,6 +339,9 @@ class ProductConfigFormController {
if (includes(error.data, 'already in the cart')) {
this.errorAlreadyInCart = true
this.onStateChange({ state: 'errorAlreadyInCart' })
} else if (error?.data?.messages[0]?.id === 'field.invalid.decimal.format') {
this.amountFormatError = error?.data?.messages[0]['debug-message']
this.onStateChange({ state: 'errorSubmitting' })
} else {
this.errorSavingGeneric = true
this.$log.error('Error adding or updating item in cart', error)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,10 @@ <h4 class="panel-title border-bottom-small" translate>
<p translate>{{'ADDING_CART_ERROR'}}</p>
</div>

<div ng-if="$ctrl.amountFormatError" role="alert" class="alert alert-danger">
<p translate>{{$ctrl.amountFormatError}}</p>
</div>

<div ng-if="$ctrl.errorAlreadyInCart" class="alert alert-warning" role="alert">
<p translate>{{'GIFT_IN_CART_ERROR'}}</p>
</div>
Expand Down

0 comments on commit 9c0480f

Please sign in to comment.