Skip to content

Commit

Permalink
Merge pull request #39 from instadeepai/feat/error_raise
Browse files Browse the repository at this point in the history
Improving Error Handling in Data Processing: Raise the error and not hide it with the print
  • Loading branch information
OmaymaMahjoub authored Feb 1, 2024
2 parents 8b11578 + ba74302 commit 9104a73
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions marl_eval/utils/data_processing_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
from typing import Any, Dict, List, Tuple, Union

import numpy as np
from colorama import Fore, Style

"""Tools for processing MARL experiment data."""

Expand Down Expand Up @@ -496,9 +497,13 @@ def _select_metrics_for_plotting(absolute_metrics: list) -> list:
return metric_dictionary_return, final_metric_tensor_dictionary

except Exception as e:
print(e, ": There is an issue related to the format of the json file!")
print(
f"\n{Fore.RED}Unexpected error: {e}. There is an issue related to the "
+ "format of the json file!"
)
print(
"We recommend using the DiagnoseData class from "
+ "marl_eval/utils/diagnose_data_errors.py to determine the error."
+ "`marl_eval/utils/diagnose_data_errors.py` for further "
+ f"investigation.\n{Style.RESET_ALL}"
)
return ({}, {})
raise

0 comments on commit 9104a73

Please sign in to comment.