Skip to content

Commit 7131d43

Browse files
committed
Renamed ProviderRequestError -> RequestError
1 parent 9b29640 commit 7131d43

File tree

3 files changed

+10
-10
lines changed

3 files changed

+10
-10
lines changed

index.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ const vimeo = require('./providers/vimeo');
1111
const youtube = require('./providers/youtube');
1212
const providers = [soundcloud, spotify, vimeo, youtube];
1313

14-
const ProviderRequestError = createError('ProviderRequestError');
14+
const RequestError = createError('RequestError');
1515

1616
/**
1717
* Factory that return Embedify instance
@@ -30,7 +30,7 @@ function create(options) {
3030
*/
3131
function Embedify(options) {
3232
this.providers = providers;
33-
this.ProviderRequestError = ProviderRequestError;
33+
this.RequestError = RequestError;
3434
this.parse = !(options && options.parse === false);
3535
this.failSoft = options && options.failSoft === true;
3636
this.client = options && options.client ? options.client : axios;
@@ -132,7 +132,7 @@ Embedify.prototype.fetch = function fetch(apiUrl, matchUrl) {
132132
}
133133

134134
const message = `Item does not exist [${matchUrl}]. Set 'failSoft' option to ignore.`;
135-
throw new this.ProviderRequestError(message);
135+
throw new this.RequestError(message);
136136
});
137137
});
138138
};

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "embedify",
3-
"version": "3.0.3",
3+
"version": "4.0.3",
44
"description": "oEmbed library for Soundcloud, Spotify, Vimeo and Youtube",
55
"main": "index.js",
66
"scripts": {

test/fetch.js

+6-6
Original file line numberDiff line numberDiff line change
@@ -29,27 +29,27 @@ describe('Fetch', () => {
2929
.then(res => expect(res).to.deep.equal(null));
3030
});
3131

32-
it('should be rejected with ProviderRequestError if status is 404 and failSoft -> false', () => {
32+
it('should be rejected with RequestError if status is 404 and failSoft -> false', () => {
3333
const url = `${serverUrl}status/404`;
3434
const oEmbed = embedify.create({ failSoft: false });
3535

3636
return expect(oEmbed.fetch(url))
37-
.to.be.rejectedWith(oEmbed.ProviderRequestError);
37+
.to.be.rejectedWith(oEmbed.RequestError);
3838
});
3939

40-
it('should be rejected with ProviderRequestError if status is 500 and failSoft -> true', () => {
40+
it('should be rejected with RequestError if status is 500 and failSoft -> true', () => {
4141
const url = `${serverUrl}status/500`;
4242
const oEmbed = embedify.create({ failSoft: true });
4343

4444
return expect(oEmbed.fetch(url))
45-
.to.be.rejectedWith(oEmbed.ProviderRequestError);
45+
.to.be.rejectedWith(oEmbed.RequestError);
4646
});
4747

48-
it('should be rejected with ProviderRequestError if status is 500 and failSoft -> false', () => {
48+
it('should be rejected with RequestError if status is 500 and failSoft -> false', () => {
4949
const url = `${serverUrl}status/500`;
5050
const oEmbed = embedify.create({ failSoft: false });
5151

5252
return expect(oEmbed.fetch(url))
53-
.to.be.rejectedWith(oEmbed.ProviderRequestError);
53+
.to.be.rejectedWith(oEmbed.RequestError);
5454
});
5555
});

0 commit comments

Comments
 (0)