Skip to content

Commit

Permalink
properly render errors from adapter
Browse files Browse the repository at this point in the history
  • Loading branch information
Scott Batson committed Nov 13, 2016
1 parent 2502eb0 commit a6837da
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 10 deletions.
1 change: 1 addition & 0 deletions app/components/error-formatter.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ const { Component, computed, Object, String } = Ember;

export default Component.extend({
classNames: ['error-formatter'],
error: null,

/**
The default error message if the error has no other messages
Expand Down
9 changes: 5 additions & 4 deletions app/templates/components/donation/donation-container.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,11 @@
{{/if}}

{{#if canAddCard}}
{{#donation/credit-card canSubmit=canSubmitAddCard submit=addCard canCancel=canShowCardList}}
{{!can be used to show errors}}
{{yield}}
{{/donation/credit-card}}
{{donation/credit-card canSubmit=canSubmitAddCard submit=addCard canCancel=canShowCardList}}
{{/if}}

{{#if responseError}}
{{error-formatter error=responseError}}
{{/if}}

{{#if canDonate}}
Expand Down
7 changes: 2 additions & 5 deletions app/templates/project/donate.hbs
Original file line number Diff line number Diff line change
@@ -1,13 +1,10 @@
{{project-header project=project}}
{{#donation/donation-container
{{donation/donation-container
addCard=(action 'addCard')
cards=user.stripeCards
donate=(action 'donate' amount)
donationAmount=amount
isAddingCard=isAddingCard
projectTitle=project.title
responseError=error
}}
{{#if error}}
{{error-formatter error=error}}
{{/if}}
{{/donation/donation-container}}
2 changes: 1 addition & 1 deletion tests/acceptance/project-donate-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ test('Shows validation errors when creating subscription fails', function(assert
});
});
projectDonatePage.cardList.cards(0).clickCard();
projectDonatePage.cardList.clickDonate();
projectDonatePage.clickDonate();
});

andThen(() => {
Expand Down

0 comments on commit a6837da

Please sign in to comment.