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

@@ -17,7 +17,7 @@ def execute():
"""
)
except Exception as e:
frappe.log_error(e, title="Patch Migration Failed")
frappe.log_error("Bank to Bank Account patch migration failed")
frappe.reload_doc("accounts", "doctype", "bank_account")
frappe.reload_doc("accounts", "doctype", "payment_request")

View File

@@ -96,8 +96,7 @@ def repost_stock_entry(doc):
make_sl_entries(sl_entries, True)
except Exception:
print(f"SLE entries not posted for the stock entry {doc.name}")
traceback = frappe.get_traceback()
frappe.log_error(traceback)
doc.log_error("Stock respost failed")
def get_sle_for_target_warehouse(doc, sl_entries, finished_item_row):

View File

@@ -56,8 +56,5 @@ def make_new_website_item(item: str) -> Union[str, None]:
web_item = make_website_item(doc) # returns [website_item.name, item_name]
return web_item[0]
except Exception:
title = f"{item}: Error while converting to Website Item "
frappe.log_error(
title + "for Item Card Group Template" + "\n\n" + frappe.get_traceback(), title=title
)
doc.log_error("Website Item creation failed")
return None

View File

@@ -40,7 +40,10 @@ def execute():
)
if purchase_invoices + sales_invoices:
frappe.log_error(json.dumps(purchase_invoices + sales_invoices, indent=2), title="Patch Log")
frappe.log_error(
"Fix invalid gain / loss patch log",
message=json.dumps(purchase_invoices + sales_invoices, indent=2),
)
acc_frozen_upto = frappe.db.get_value("Accounts Settings", None, "acc_frozen_upto")
if acc_frozen_upto:

View File

@@ -18,4 +18,4 @@ def execute():
).run()
except Exception:
frappe.log_error(title="Failed to Patch SLA Status")
frappe.log_error("Failed to Patch SLA Status")