Skip to content

Commit

Permalink
Merge pull request stripe#530 from stripe/ob-export-errors
Browse files Browse the repository at this point in the history
Export errors on root Stripe object
  • Loading branch information
ob-stripe authored Dec 6, 2018
2 parents ff03b68 + 5ae298b commit 180bd63
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 7 deletions.
5 changes: 4 additions & 1 deletion lib/stripe.js
Original file line number Diff line number Diff line change
Expand Up @@ -142,10 +142,13 @@ function Stripe(key, version) {
this.setApiKey(key);
this.setApiVersion(version);

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

Stripe.errors = require('./Error');
Stripe.webhooks = require('./Webhooks');

Stripe.prototype = {

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

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

describe('FileUpload', function() {
Expand Down
9 changes: 9 additions & 0 deletions test/stripe.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -209,4 +209,13 @@ describe('Stripe Module', function() {
});
});
});

describe('errors', function() {
it('Exports errors as types', function() {
var Stripe = require('../lib/stripe');
expect(new Stripe.errors.StripeInvalidRequestError({
message: 'error'
}).type).to.equal('StripeInvalidRequestError');
});
});
});

0 comments on commit 180bd63

Please sign in to comment.