🐛 Fix some bugs (#92)

🐛 修复了许多错误。
This commit is contained in:
Xtao_dada 2021-06-19 21:18:55 +08:00 committed by GitHub
parent 67e003b881
commit cb7697b895
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 2 deletions

View File

@ -4,6 +4,7 @@ import sentry_sdk
from sentry_sdk.integrations.redis import RedisIntegration from sentry_sdk.integrations.redis import RedisIntegration
from concurrent.futures import CancelledError from concurrent.futures import CancelledError
from asyncio.exceptions import CancelledError as CancelError
from subprocess import run, PIPE from subprocess import run, PIPE
from time import time from time import time
from os import getcwd, makedirs from os import getcwd, makedirs
@ -21,6 +22,7 @@ from telethon.errors.rpcerrorlist import MessageNotModifiedError, MessageIdInval
ChatSendMediaForbiddenError, YouBlockedUserError, FloodWaitError, ChatWriteForbiddenError ChatSendMediaForbiddenError, YouBlockedUserError, FloodWaitError, ChatWriteForbiddenError
from telethon.errors.common import AlreadyInConversationError from telethon.errors.common import AlreadyInConversationError
from requests.exceptions import ChunkedEncodingError from requests.exceptions import ChunkedEncodingError
from requests.exceptions import ConnectionError as ConnectedError
from sqlite3 import OperationalError from sqlite3 import OperationalError
from http.client import RemoteDisconnected from http.client import RemoteDisconnected
from urllib.error import URLError from urllib.error import URLError
@ -206,6 +208,10 @@ def before_send(event, hint):
return None return None
elif exc_info and isinstance(exc_info[1], AlreadyInConversationError): elif exc_info and isinstance(exc_info[1], AlreadyInConversationError):
return None return None
elif exc_info and isinstance(exc_info[1], CancelError):
return None
elif exc_info and isinstance(exc_info[1], ConnectedError):
return None
if time() <= report_time + 30: if time() <= report_time + 30:
report_time = time() report_time = time()
return None return None
@ -217,7 +223,7 @@ def before_send(event, hint):
report_time = time() report_time = time()
git_hash = run("git rev-parse HEAD", stdout=PIPE, shell=True).stdout.decode() git_hash = run("git rev-parse HEAD", stdout=PIPE, shell=True).stdout.decode()
sentry_sdk.init( sentry_sdk.init(
"https://77fbfe3e22a24652894aaec0e6074c7b@o416616.ingest.sentry.io/5312335", "https://86690706c3f94854ae105fffb74362ae@o416616.ingest.sentry.io/5312335",
traces_sample_rate=1.0, traces_sample_rate=1.0,
release=git_hash, release=git_hash,
before_send=before_send, before_send=before_send,

View File

@ -26,7 +26,10 @@ async def animate(context):
while count != len(words): while count != len(words):
await sleep(interval) await sleep(interval)
buffer = f"{buffer} {words[count]}" buffer = f"{buffer} {words[count]}"
await context.edit(buffer) try:
await context.edit(buffer)
except:
pass
count += 1 count += 1