Skip to content

Commit

Permalink
Merge pull request #459 from stripe/brandur-typed-error-access
Browse files Browse the repository at this point in the history
Export errors to allow typed access to them
  • Loading branch information
brandur-stripe authored May 14, 2018
2 parents 5b3318a + a220f18 commit edea141
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
1 change: 1 addition & 0 deletions lib/stripe.js
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ function Stripe(key, version) {
this.setApiKey(key);
this.setApiVersion(version);

this.errors = require('./Error.js');
this.webhooks = require('./Webhooks');
}

Expand Down
6 changes: 6 additions & 0 deletions test/flows.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -515,5 +515,11 @@ describe('Flows', function() {
done();
});
});

it('Exports errors as types', function() {
expect(new stripe.errors.StripeInvalidRequestError({
message: 'error'
}).type).to.equal('StripeInvalidRequestError');
});
});
});

0 comments on commit edea141

Please sign in to comment.