Checking result status rather than ok for imgur methods.
This commit is contained in:
parent
d9845bc596
commit
45182c07db
|
@ -47,9 +47,10 @@ users.forEach(username => {
|
||||||
submissions
|
submissions
|
||||||
}));
|
}));
|
||||||
}).then(({user, submissions}) => {
|
}).then(({user, submissions}) => {
|
||||||
const posts = curateSubmissions(submissions, ignore).slice(0, limit);
|
const posts = curateSubmissions(submissions, ignore);
|
||||||
|
const limitedPosts = posts.slice(0, limit);
|
||||||
|
|
||||||
return fetchInfo(posts).then(info => ({
|
return fetchInfo(limitedPosts).then(info => ({
|
||||||
user,
|
user,
|
||||||
posts
|
posts
|
||||||
}));
|
}));
|
||||||
|
|
|
@ -10,7 +10,7 @@ function imgurAlbum(post) {
|
||||||
'Authorization': `Client-ID ${config.methods.imgur.clientId}`
|
'Authorization': `Client-ID ${config.methods.imgur.clientId}`
|
||||||
}
|
}
|
||||||
}).then(res => res.json()).then(res => {
|
}).then(res => res.json()).then(res => {
|
||||||
if(!res.ok) {
|
if(res.status !== 200) {
|
||||||
throw new Error(`Could not fetch info for imgur album '${post.host.id}': ${res.data.error}`);
|
throw new Error(`Could not fetch info for imgur album '${post.host.id}': ${res.data.error}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -10,7 +10,7 @@ function imgurImage(post) {
|
||||||
'Authorization': `Client-ID ${config.methods.imgur.clientId}`
|
'Authorization': `Client-ID ${config.methods.imgur.clientId}`
|
||||||
}
|
}
|
||||||
}).then(res => res.json()).then(res => {
|
}).then(res => res.json()).then(res => {
|
||||||
if(!res.ok) {
|
if(res.status !== 200) {
|
||||||
throw new Error(`Could not fetch info for imgur image '${post.host.id}': ${res.data.error}`);
|
throw new Error(`Could not fetch info for imgur image '${post.host.id}': ${res.data.error}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue