aboutsummaryrefslogtreecommitdiff
path: root/ethosu/vela/architecture_features.py
diff options
context:
space:
mode:
authorMichael McGeagh <michael.mcgeagh@arm.com>2020-12-02 15:29:22 +0000
committerMichael McGeagh <michael.mcgeagh@arm.com>2020-12-14 11:38:03 +0000
commit7a6f8438aaf750380a9fff799ca81ff5c7e2ae43 (patch)
tree163c6868ec869ae52a5cfd848207dcf0ef7b212e /ethosu/vela/architecture_features.py
parent9b43f846b144d39bfb0cf16853bf6901c74b6672 (diff)
downloadethos-u-vela-7a6f8438aaf750380a9fff799ca81ff5c7e2ae43.tar.gz
MLBEDSW-2066 Improve Exception messages
Minor refactoring to use fstrings. Improve Error classes to correctly inherit the base class. Use existing exception classes instead of plain exceptions where it makes sense. Signed-off-by: Michael McGeagh <michael.mcgeagh@arm.com> Change-Id: I0941c04e91010da1db77299517a8e2d896371e77
Diffstat (limited to 'ethosu/vela/architecture_features.py')
-rw-r--r--ethosu/vela/architecture_features.py17
1 files changed, 6 insertions, 11 deletions
diff --git a/ethosu/vela/architecture_features.py b/ethosu/vela/architecture_features.py
index 354ab12c..576f793a 100644
--- a/ethosu/vela/architecture_features.py
+++ b/ethosu/vela/architecture_features.py
@@ -531,13 +531,11 @@ class ArchitectureFeatures:
self._set_default_sys_config()
elif vela_config_files is None:
- raise CliOptionError("--config", vela_config_files, "CLI Option not specified")
+ raise CliOptionError("--config", vela_config_files, "Vela config file not specified")
else:
raise CliOptionError(
- "--system-config",
- self.system_config,
- "Section {} not found in Vela config file".format(sys_cfg_section),
+ "--system-config", self.system_config, f"Section {sys_cfg_section} not found in Vela config file",
)
# read the memory mode
@@ -559,11 +557,11 @@ class ArchitectureFeatures:
self._set_default_mem_mode()
elif vela_config_files is None:
- raise CliOptionError("--config", vela_config_files, "CLI Option not specified")
+ raise CliOptionError("--config", vela_config_files, "Vela config file not specified")
else:
raise CliOptionError(
- "--memory-mode", self.memory_mode, "Section {} not found in Vela config file".format(mem_mode_section),
+ "--memory-mode", self.memory_mode, f"Section {mem_mode_section} not found in Vela config file",
)
# override sram to onchipflash
@@ -645,9 +643,7 @@ class ArchitectureFeatures:
particular option then the key from the parent section is used, regardless of the parsing order
"""
if not self.vela_config.has_section(section):
- raise ConfigOptionError(
- "section", "{}. The section was not found in the Vela config file(s)".format(section)
- )
+ raise ConfigOptionError("section", f"{section}. The section was not found in the Vela config file(s)")
result = str(current_value)
if self.vela_config.has_option(section, "inherit"):
@@ -655,8 +651,7 @@ class ArchitectureFeatures:
# check for recursion loop
if inheritance_section == section:
raise ConfigOptionError(
- "inherit",
- "{}. This references its own section and recursion is not allowed".format(inheritance_section),
+ "inherit", f"{inheritance_section}. This references its own section and recursion is not allowed",
)
result = self._read_config(inheritance_section, key, result)