|
1 | 1 | import logging |
| 2 | +import traceback |
2 | 3 | from datetime import datetime, timezone |
3 | 4 | from time import sleep |
4 | 5 |
|
@@ -218,7 +219,8 @@ def post_dependent_cost_code(import_log: ImportLog, dependent_field_setting: Dep |
218 | 219 | platform.dependent_fields.bulk_post_dependent_expense_field_values(payload_set) |
219 | 220 | posted_cost_codes.update(cost_code_names) |
220 | 221 | processed_batches += 1 |
221 | | - except Exception as exception: |
| 222 | + except Exception: |
| 223 | + exception = traceback.format_exc() |
222 | 224 | is_errored = True |
223 | 225 | logger.error(f'Exception while posting dependent cost code | Error: {exception} | Payload: {payload}') |
224 | 226 |
|
@@ -308,7 +310,8 @@ def post_dependent_cost_type(import_log: ImportLog, dependent_field_setting: Dep |
308 | 310 | platform.dependent_fields.bulk_post_dependent_expense_field_values(payload_set) |
309 | 311 | CostType.objects.filter(task_name=cost_types['task_name'], task_id=cost_types['task_id'], workspace_id=dependent_field_setting.workspace_id).update(is_imported=True, updated_at=datetime.now(timezone.utc)) |
310 | 312 | processed_batches += 1 |
311 | | - except Exception as exception: |
| 313 | + except Exception: |
| 314 | + exception = traceback.format_exc() |
312 | 315 | is_errored = True |
313 | 316 | logger.error(f'Exception while posting dependent cost type | Error: {exception} | Payload: {payload}') |
314 | 317 |
|
@@ -439,8 +442,8 @@ def import_dependent_fields_to_fyle(workspace_id: str) -> None: |
439 | 442 | except SageIntacctSDKError as e: |
440 | 443 | exception = "Sage Intacct SDK Error" |
441 | 444 | logger.info('Sage Intacct SDK Error - %s', e) |
442 | | - except Exception as e: |
443 | | - exception = e.__str__() |
| 445 | + except Exception: |
| 446 | + exception = traceback.format_exc() |
444 | 447 | logger.error('Exception while importing dependent fields to fyle - %s', exception) |
445 | 448 | finally: |
446 | 449 | if cost_type_import_log and cost_type_import_log.status == 'IN_PROGRESS': |
|
0 commit comments