Skip to content

Commit

Permalink
use repr instead of str to print error message
Browse files Browse the repository at this point in the history
  • Loading branch information
sgrtye committed May 28, 2024
1 parent e74850d commit 45375ff
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion netguard/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ def send_notification():
batch_id = None

except Exception as e:
print(datetime.datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(e))
print(datetime.datetime.now().strftime("%Y-%m-%d %H:%M:%S"), repr(e))
print(f"Error occurred on line {e.__traceback__.tb_lineno}")

if __name__ == "__main__":
Expand Down
8 changes: 4 additions & 4 deletions novel/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,8 @@ def load_proxies():
return proxies

except Exception as e:
print(datetime.datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(e))
bot.send_message(TELEBOT_USER_ID, str(e))
print(datetime.datetime.now().strftime("%Y-%m-%d %H:%M:%S"), repr(e))
bot.send_message(TELEBOT_USER_ID, repr(e))
raise SystemExit


Expand Down Expand Up @@ -215,7 +215,7 @@ def start_api_server():
break

except Exception as e:
print(datetime.datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(e))
print(datetime.datetime.now().strftime("%Y-%m-%d %H:%M:%S"), repr(e))
print(
f"Error occurred when checking {books[i][1]} with proxy {ip}:{port}"
)
Expand All @@ -236,7 +236,7 @@ def start_api_server():
)
bot.send_message(
TELEBOT_USER_ID,
f"The exception occurred when processing book {books[i][1]} with error message: {str(e)}",
f"The exception occurred when processing book {books[i][1]} with error message: {repr(e)}",
)
print(
datetime.datetime.now().strftime("%Y-%m-%d %H:%M:%S"),
Expand Down
2 changes: 1 addition & 1 deletion submanager/remove_subscription.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ def remove_old_client_config():
"Old client config files removed",
)
except Exception as e:
print(datetime.datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(e))
print(datetime.datetime.now().strftime("%Y-%m-%d %H:%M:%S"), repr(e))
print(f"Error occurred on line {e.__traceback__.tb_lineno}")


Expand Down
2 changes: 1 addition & 1 deletion submanager/update_nginx_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ def update():
update_nginx_config(credentials)

except Exception as e:
print(datetime.datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(e))
print(datetime.datetime.now().strftime("%Y-%m-%d %H:%M:%S"), repr(e))
print(f"Error occurred on line {e.__traceback__.tb_lineno}")


Expand Down
2 changes: 1 addition & 1 deletion submanager/update_subscription.py
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ def update():
update_client_config(locations, providers, credentials)

except Exception as e:
print(datetime.datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(e))
print(datetime.datetime.now().strftime("%Y-%m-%d %H:%M:%S"), repr(e))
print(f"Error occurred on line {e.__traceback__.tb_lineno}")


Expand Down

0 comments on commit 45375ff

Please sign in to comment.