+21
-14
app.ts
+21
-14
app.ts
···
733
733
//I wait 3 seconds so as not to exceed the api rate limits
734
734
await new Promise(resolve => setTimeout(resolve, API_DELAY));
735
735
736
-
const recordData = await rateLimitedAgent.post(postRecord);
737
-
const i = recordData.uri.lastIndexOf("/");
738
-
if (i > 0) {
739
-
const postUri = getBskyPostUrl(recordData.uri);
740
-
console.log("Bluesky post create, URL: " + postUri);
736
+
try
737
+
{
738
+
const recordData = await rateLimitedAgent.post(postRecord);
739
+
const i = recordData.uri.lastIndexOf("/");
740
+
if (i > 0) {
741
+
const postUri = getBskyPostUrl(recordData.uri);
742
+
console.log("Bluesky post create, URL: " + postUri);
741
743
742
-
importedTweet++;
743
-
} else {
744
-
console.warn(recordData);
744
+
importedTweet++;
745
+
} else {
746
+
console.warn(recordData);
747
+
}
748
+
749
+
// store bsky data into sortedTweets (then write into the mapping file)
750
+
currentData.bsky = {
751
+
uri: recordData.uri,
752
+
cid: recordData.cid,
753
+
};
754
+
}
755
+
catch (error: any) {
756
+
console.warn(`Error posting tweet: ${postRecord} ${error.message}`);
745
757
}
746
-
747
-
// store bsky data into sortedTweets (then write into the mapping file)
748
-
currentData.bsky = {
749
-
uri: recordData.uri,
750
-
cid: recordData.cid,
751
-
};
758
+
752
759
} else {
753
760
importedTweet++;
754
761
}