浏览代码

MOD:去除raise

cxyu 3 年之前
父节点
当前提交
8256d9d18a
共有 4 个文件被更改,包括 1 次插入11 次删除
  1. 0 3
      web_module/tornado_api.py
  2. 0 4
      web_module/user_action.py
  3. 0 2
      wechat_action/create_ad_layout.py
  4. 1 2
      wechat_action/create_ad_plan.py

+ 0 - 3
web_module/tornado_api.py

@@ -140,7 +140,6 @@ class create_ad_plan(BaseHandler):
 
             logging.error(str(e))
             self.write('error')
-            raise
         finally:
             sql_session.commit()
 
@@ -347,7 +346,6 @@ class ad_human_info(BaseHandler):
             if log_ad:
                 log_ad.driver.quit()
             logging.error(str(e))
-            raise
         finally:
             sql_session.commit()
 
@@ -473,7 +471,6 @@ class ad_wechat_info(BaseHandler):
             if log_ad:
                 log_ad.driver.quit()
             logging.error(str(e))
-            raise
         finally:
             sql_session.commit()
 

+ 0 - 4
web_module/user_action.py

@@ -66,7 +66,6 @@ def carry_plan(user_id, ad_plan_list, log_ad, db, cookie_canuse, task_name):
                         sql_tools.action_record(res, sql_session, ad_plan_create_action, user_id, plan_name,
                                                 action_record_table,
                                                 service_name, wechat_name, task_name)
-                        raise
                         continue
 
                 log_ad.refresh_driver()
@@ -91,7 +90,6 @@ def carry_plan(user_id, ad_plan_list, log_ad, db, cookie_canuse, task_name):
                 sql_tools.action_record(res, sql_session, ad_plan_create_action, user_id, plan_name,
                                         action_record_table,
                                         service_name, wechat_name, task_name)
-                raise
             finally:
                 log_ad.refresh_driver()
 
@@ -100,7 +98,6 @@ def carry_plan(user_id, ad_plan_list, log_ad, db, cookie_canuse, task_name):
         sql_tools.update_task_status_error(sql_session=sql_session, user_id=user_id, task_name=task_name)
         dingtalk.send_message('user_id:{} 计划执行出错,进行检查\n{}'.format(user_id, str(e)))
         logging.error(e)
-        raise
     finally:
         logging.info('创建计划,任务结束')
         # 每次运行微信相关操作,对微信相关信息进行刷新
@@ -209,7 +206,6 @@ def get_human_info(user_id, log_ad, db, cookie_canuse, task_name):
         dingtalk.send_message('user_id:{} 获取微信数据出错,进行检查\n{}'.format(user_id, str(e)))
         log_ad.refresh_driver()
         logging.error(e)
-        raise
     finally:
         logging.info('刷新用户,任务结束')
         sql_session.commit()

+ 0 - 2
wechat_action/create_ad_layout.py

@@ -1,7 +1,6 @@
 from selenium.webdriver.support.wait import WebDriverWait
 from selenium.webdriver.common.keys import Keys
 from selenium.webdriver import ActionChains
-import pyperclip
 from logging import handlers
 import logging
 import requests
@@ -775,7 +774,6 @@ class CreateAd:
                     self.get_into_create_page()
                     return self.create_layout(layout, sql_session, err_num=err_num + 1)
         except Exception as e:
-            raise
             logging.error(e)
             # TODO:有空时讲 e 内容设置为原始内容
             if err_num > 3:

+ 1 - 2
wechat_action/create_ad_plan.py

@@ -412,7 +412,6 @@ class CreateAdPlan():
                                                    sql_session=sql_session)
                     return self.run(sql_session, err_num=err_num + 1)
         except Exception as e:
-            raise
             # self.driver.save_screenshot('liuyi{}.png'.format(time.time()))
             time.sleep(5)
 
@@ -423,4 +422,4 @@ class CreateAdPlan():
                 self.login_ad.refresh_driver()
                 self.login_ad.select_ad_master(service_name=self.service_name, wechat_name=self.wechat_name,
                                                sql_session=sql_session)
-                return self.run(sql_sesion, err_num=err_num + 1)
+                return self.run(sql_session, err_num=err_num + 1)