fix(minor): update frappe.error_log to new API (#30864)

* fix(minor): update frappe.error_log to new API

* refactor: changes for updated log_error api

Co-authored-by: Ankush Menat <ankush@frappe.io>
This commit is contained in:
Rushabh Mehta
2022-05-02 15:04:26 +05:30
committed by GitHub
parent dcda55641b
commit 548afba8bb
33 changed files with 59 additions and 97 deletions

View File

@@ -36,8 +36,7 @@ class Video(Document):
self.comment_count = video_stats.get("commentCount")
except Exception:
title = "Failed to Update YouTube Statistics for Video: {0}".format(self.name)
frappe.log_error(title + "\n\n" + frappe.get_traceback(), title=title)
self.log_error("Unable to update YouTube statistics")
def is_tracking_enabled():
@@ -109,8 +108,7 @@ def batch_update_youtube_data():
video_stats = video.items
return video_stats
except Exception:
title = "Failed to Update YouTube Statistics"
frappe.log_error(title + "\n\n" + frappe.get_traceback(), title=title)
frappe.log_error("Unable to update YouTube statistics")
def prepare_and_set_data(video_list):
video_ids = get_formatted_ids(video_list)

View File

@@ -18,5 +18,5 @@ class VideoSettings(Document):
build("youtube", "v3", developerKey=self.api_key)
except Exception:
title = _("Failed to Authenticate the API key.")
frappe.log_error(title + "\n\n" + frappe.get_traceback(), title=title)
self.log_error("Failed to authenticate API key")
frappe.throw(title + " Please check the error logs.", title=_("Invalid Credentials"))