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
diff --git a/ethosu/vela/tflite_writer.py b/ethosu/vela/tflite_writer.py
index f747d47..06026ba 100644
--- a/ethosu/vela/tflite_writer.py
+++ b/ethosu/vela/tflite_writer.py
@@ -21,6 +21,7 @@
from flatbuffers import encode
from flatbuffers.builder import UOffsetTFlags
+from .errors import VelaError
from .nn_graph import PassPlacement
from .operation import Op
from .tensor import MemType
@@ -44,7 +45,7 @@
def FinishWithFileIdentifier(self, rootTable, fid):
if fid is None or len(fid) != 4:
- raise Exception("fid must be 4 chars")
+ raise VelaError("FileIdentifier must be 4 chars")
flags = N.Uint8Flags
prepSize = 4