exp is now exc

This commit is contained in:
2023-08-16 13:27:23 +02:00
parent 5e8506cc12
commit 1d88076285
6 changed files with 37 additions and 37 deletions

View File

@@ -58,8 +58,8 @@ async def cli_create_user() -> None:
none = input(
"Alright. If you have email confirmation enabled - please confirm registration by using the link in your email. After that press Enter. Otherwise just press Enter."
)
except Exception as exp:
print(f"Could not create a user due to {exp}", flush=True)
except Exception as exc:
print(f"Could not create a user due to {exc}", flush=True)
print_exc()
exit()
if not args.create_album:
@@ -97,8 +97,8 @@ async def cli_create_album() -> None:
result_2 = await album_create(client=client, name=name, title=title)
# asyncio.run(create_album(name, title))
await config_set("album", name, "posting", "api")
except Exception as exp:
print(f"Could not create an album due to {exp}", flush=True)
except Exception as exc:
print(f"Could not create an album due to {exc}", flush=True)
print_exc()
exit()
print("You're done!", flush=True)

View File

@@ -77,12 +77,12 @@ async def send_content(app: PyroClient, http_session: ClientSession) -> None:
try:
response: File = await func_iter[1](id=media.id, client=client)
except Exception as exp:
except Exception as exc:
print_exc()
logger.error("Media is invalid: %s", exp)
logger.error("Media is invalid: %s", exc)
if app.config["reports"]["error"]:
await app.send_message(
app.owner, f"Media is invalid: {exp}"
app.owner, f"Media is invalid: {exc}"
)
return
@@ -103,11 +103,11 @@ async def send_content(app: PyroClient, http_session: ClientSession) -> None:
).results[0]
try:
response: File = await func[1](id=media.id, client=client)
except Exception as exp:
except Exception as exc:
print_exc()
logger.error("Media is invalid: %s", exp)
logger.error("Media is invalid: %s", exc)
if app.config["reports"]["error"]:
await app.send_message(app.owner, f"Media is invalid: {exp}")
await app.send_message(app.owner, f"Media is invalid: {exc}")
return
except (KeyError, AttributeError, TypeError, IndexError):
@@ -217,14 +217,14 @@ async def send_content(app: PyroClient, http_session: ClientSession) -> None:
caption=caption,
disable_notification=app.config["posting"]["silent"],
)
except Exception as exp:
except Exception as exc:
logger.error(
"Could not send media %s (%s) due to %s", media.filename, media.id, exp
"Could not send media %s (%s) due to %s", media.filename, media.id, exc
)
if app.config["reports"]["error"]:
await app.send_message(
app.owner,
app._("post_exception", "message").format(exp, format_exc()),
app._("post_exception", "message").format(exc, format_exc()),
)
# rmtree(path.join(app.config['locations']['tmp'], tmp_dir), ignore_errors=True)
return
@@ -253,14 +253,14 @@ async def send_content(app: PyroClient, http_session: ClientSession) -> None:
str(app.config["posting"]["silent"]),
)
except Exception as exp:
except Exception as exc:
logger.error(
"Could not send content due to %s. Traceback: %s", exp, format_exc()
"Could not send content due to %s. Traceback: %s", exc, format_exc()
)
if app.config["reports"]["error"]:
await app.send_message(
app.owner,
app._("post_exception", "message").format(exp, format_exc()),
app._("post_exception", "message").format(exc, format_exc()),
)
try:
rmtree(