Browse Source

[add][try catch]

zhangwei 2 years ago
parent
commit
e7c465ca6e
1 changed files with 9 additions and 5 deletions
  1. 9 5
      src/logic/content/twitter.js

+ 9 - 5
src/logic/content/twitter.js

@@ -1602,11 +1602,15 @@ const TwitterApiCreateTweet = ({ text, tweet_Id }) => {
 }
 
 const sendChromeMessage = (done, tweet_Id, response) => {
-    console.log('sendChromeMessage', done)
-    if (done == '是') {
-        chrome.runtime.sendMessage({ actionType: "DO_TASK", do_type: 'api', tweet_Id, task_type: 'createTweet1', task_data: '', task_done: '是', response })
-    } else {
-        chrome.runtime.sendMessage({ actionType: "DO_TASK", do_type: 'api', tweet_Id, task_type: 'createTweet1', task_data: '', task_done: '否' })
+    try {
+        console.log('sendChromeMessage', done)
+        if (done == '是') {
+            chrome.runtime.sendMessage({ actionType: "DO_TASK", do_type: 'api', tweet_Id, task_type: 'createTweet1', task_data: '', task_done: '是', response })
+        } else {
+            chrome.runtime.sendMessage({ actionType: "DO_TASK", do_type: 'api', tweet_Id, task_type: 'createTweet1', task_data: '', task_done: '否' })
+        }
+    } catch (error) {
+        console.error('catch', error)
     }
 }