chore: error logging

This commit is contained in:
Saqib Ansari
2020-11-05 10:49:21 +05:30
committed by Saurabh
parent fb65644026
commit 4965af2321

View File

@@ -237,8 +237,8 @@ def make_einvoice(doctype, name):
item_list = get_item_list(invoice) item_list = get_item_list(invoice)
doc_details = get_doc_details(invoice) doc_details = get_doc_details(invoice)
value_details = get_value_details(invoice) value_details = get_value_details(invoice)
trans_details = get_trans_details(invoice)
seller_details = get_party_details(invoice.company_address) seller_details = get_party_details(invoice.company_address)
seller_details.update({ 'pincode': 193502 })
if invoice.gst_category == 'Overseas': if invoice.gst_category == 'Overseas':
buyer_details = get_overseas_address_details(invoice.customer_address) buyer_details = get_overseas_address_details(invoice.customer_address)
@@ -496,15 +496,15 @@ class GSPConnector():
docname = args.docname docname = args.docname
eway_bill_details = get_eway_bill_details(args) eway_bill_details = get_eway_bill_details(args)
data = json.dumps({ data = json.dumps({
"Irn": args.irn, 'Irn': args.irn,
"Distance": cint(eway_bill_details.distance), 'Distance': cint(eway_bill_details.distance),
"TransMode": eway_bill_details.mode_of_transport, 'TransMode': eway_bill_details.mode_of_transport,
"TransId": eway_bill_details.gstin, 'TransId': eway_bill_details.gstin,
"TransName": eway_bill_details.transporter, 'TransName': eway_bill_details.transporter,
"TrnDocDt": eway_bill_details.document_date, 'TrnDocDt': eway_bill_details.document_date,
"TrnDocNo": eway_bill_details.document_name, 'TrnDocNo': eway_bill_details.document_name,
"VehNo": eway_bill_details.vehicle_no, 'VehNo': eway_bill_details.vehicle_no,
"VehType": eway_bill_details.vehicle_type 'VehType': eway_bill_details.vehicle_type
}) })
try: try:
@@ -544,7 +544,13 @@ class GSPConnector():
self.log_error(e) self.log_error(e)
def log_error(self, exc): def log_error(self, exc):
print(exc) message = "\n".join(["Data:", json.dumps(exc), "--" * 50, "\nException:", traceback.format_exc()])
frappe.log_error(title="E Invoicing Error", message=message)
link_to_error_list = '<a href="desk#List/{0}">{1}</a>'.format('Error Log', 'Error Log')
frappe.throw(
_('An error occurred while making API request. Please check {} for more information.').format(link_to_error_list),
title=_('E Invoice Request Failed')
)
@frappe.whitelist() @frappe.whitelist()
def generate_irn(docname): def generate_irn(docname):