Checking result status rather than ok for imgur methods.
This commit is contained in:
parent
a882f564f5
commit
1581e780b8
|
@ -47,9 +47,10 @@ users.forEach(username => {
|
|||
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,
|
||||
posts
|
||||
}));
|
||||
|
|
|
@ -10,7 +10,7 @@ function imgurAlbum(post) {
|
|||
'Authorization': `Client-ID ${config.methods.imgur.clientId}`
|
||||
}
|
||||
}).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}`);
|
||||
}
|
||||
|
||||
|
|
|
@ -10,7 +10,7 @@ function imgurImage(post) {
|
|||
'Authorization': `Client-ID ${config.methods.imgur.clientId}`
|
||||
}
|
||||
}).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}`);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue