aboutsummaryrefslogtreecommitdiff
path: root/src/mlia/backend
diff options
context:
space:
mode:
Diffstat (limited to 'src/mlia/backend')
-rw-r--r--src/mlia/backend/errors.py12
-rw-r--r--src/mlia/backend/tosa_checker/compat.py6
2 files changed, 15 insertions, 3 deletions
diff --git a/src/mlia/backend/errors.py b/src/mlia/backend/errors.py
new file mode 100644
index 0000000..bd5da95
--- /dev/null
+++ b/src/mlia/backend/errors.py
@@ -0,0 +1,12 @@
+# SPDX-FileCopyrightText: Copyright 2022, Arm Limited and/or its affiliates.
+# SPDX-License-Identifier: Apache-2.0
+"""Backend errors."""
+
+
+class BackendUnavailableError(Exception):
+ """Backend unavailable error."""
+
+ def __init__(self, msg: str, backend: str) -> None:
+ """Init error."""
+ super().__init__(msg)
+ self.backend = backend
diff --git a/src/mlia/backend/tosa_checker/compat.py b/src/mlia/backend/tosa_checker/compat.py
index e1bcb24..bd21774 100644
--- a/src/mlia/backend/tosa_checker/compat.py
+++ b/src/mlia/backend/tosa_checker/compat.py
@@ -8,6 +8,7 @@ from typing import Any
from typing import cast
from typing import Protocol
+from mlia.backend.errors import BackendUnavailableError
from mlia.core.typing import PathOrFileLike
@@ -45,9 +46,8 @@ def get_tosa_compatibility_info(
checker = get_tosa_checker(tflite_model_path)
if checker is None:
- raise Exception(
- "TOSA checker is not available. "
- "Please make sure that 'tosa-checker' backend is installed."
+ raise BackendUnavailableError(
+ "Backend tosa-checker is not available", "tosa-checker"
)
ops = [