From 95f537024b35557cc5a7284b95bca53ed01370c3 Mon Sep 17 00:00:00 2001 From: adb Date: Fri, 26 Feb 2021 00:45:10 +0100 Subject: [PATCH] fix scope --- node_app/mastodonHandler.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/node_app/mastodonHandler.js b/node_app/mastodonHandler.js index 1608f3e..aec7486 100644 --- a/node_app/mastodonHandler.js +++ b/node_app/mastodonHandler.js @@ -9,11 +9,11 @@ export class MastodonHandler extends Mastodon{ }); } postMedia(status, mediaPath, retry, onError){ + if (retry <= 0){ + onError(); + return; + } this.post('media', { file: fs.createReadStream(mediaPath) }).then(resp => { - if (retry <= 0){ - onError(); - return; - } if (!resp.data.id){ this.postMedia(status, mediaPath, --retry); console.log("issue while uploading, retry")