core: minor logical fixes

This commit is contained in:
ZhymabekRoman 2024-06-10 22:03:22 +05:00
parent 9ea3b316de
commit 2d8c0d012d
4 changed files with 8 additions and 5 deletions

View file

@ -34,7 +34,7 @@ async def render_postleter(limit: int = 30, as_html: bool = False):
post_metadata = await post.generate_metadata(as_dict=True)
outlet_posts_list.append(post_metadata)
except Exception as ex:
await handle_exception(ex, message=f"Couldn't render post_id for postleter: {post_id}")
await handle_exception(ex, message=f"Couldn't render post_id for postleter: {post_id}. Just ignore that")
task = fetch_post_metadata(post_id)
tasks.append(task)
@ -87,7 +87,7 @@ async def render_medium_post_link(path: str, use_cache: bool = True, use_redis:
except medium_parser_exceptions.InvalidMediumPostID as ex:
return await handle_exception(ex, "Unable to identify the Medium article ID.", status_code=500)
except medium_parser_exceptions.NotValidMediumURL as ex:
return await handle_exception("You sure that this is a valid Medium.com URL?", status_code=404, quiet=True)
return await handle_exception(ex, "You sure that this is a valid Medium.com URL?", status_code=404, quiet=True)
except Exception as ex:
return await handle_exception(ex, status_code=500)
else:

View file

@ -84,7 +84,7 @@ Warm regards, The Freedium Team
<nav id="header" class="fixed w-full z-9 top-0 dark:bg-gray-800 dark:text-white bg-white shadow" style="z-index: 999990;">
{% if enable_ads_header %}
<div class="w-full bg-yellow-400 text-center py-1 px-4">
<p class="text-yellow-900">Place your advertisement here! Contact us at advertise@freedium.com</p>
<p class="text-yellow-900">Advertise here and support our project! Reach out to us at admin@freedium.com</p>
</div>
{% endif %}
<div id="progress" class="h-1 z-20 top-0" style="background:linear-gradient(to right, #4dc0b5 var(--scroll), transparent 0)"></div>

View file

@ -6,5 +6,7 @@ from server.utils.error import generate_error
async def handle_exception(ex, message="An error occurred", status_code=500, quiet: bool = False):
logger.exception(ex)
# sentry_sdk.capture_exception(ex)
return await generate_error(message, status_code=status_code)
if not quiet:
sentry_sdk.capture_exception(ex)
return await generate_error(message, status_code=status_code, quiet=quiet)

View file

@ -17,6 +17,7 @@ def send_message(text: str, silent: bool = False, status: MessageStatus = "ERROR
return
if status == MessageStatus.GOOD.value:
logger.warning(f"Ignoring sending GOOD message")
return True
if len(text) > 4000: