Checking result status rather than ok for imgur methods.

This commit is contained in:
DebaucheryLibrarian 2024-09-11 05:16:54 +02:00
parent a882f564f5
commit 1581e780b8
3 changed files with 5 additions and 4 deletions

View File

@ -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
})); }));

View File

@ -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}`);
} }

View File

@ -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}`);
} }