diff options
author | Patrick Lehmann <Patrick.Lehmann@plc2.de> | 2021-06-22 22:02:30 +0200 |
---|---|---|
committer | Patrick Lehmann <Patrick.Lehmann@plc2.de> | 2021-06-22 22:02:30 +0200 |
commit | cebb4aec31557a9235ff6c5666fd6b71864788eb (patch) | |
tree | 2915085f8ca5aa015a91fbe1dc892281d4986d04 /pyGHDL/dom | |
parent | c5a4e881debcc75bdb96cdddd4abda10fd778b68 (diff) | |
download | ghdl-cebb4aec31557a9235ff6c5666fd6b71864788eb.tar.gz ghdl-cebb4aec31557a9235ff6c5666fd6b71864788eb.tar.bz2 ghdl-cebb4aec31557a9235ff6c5666fd6b71864788eb.zip |
Report file and line of an error reported by libghdl.
Diffstat (limited to 'pyGHDL/dom')
-rw-r--r-- | pyGHDL/dom/_Utils.py | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/pyGHDL/dom/_Utils.py b/pyGHDL/dom/_Utils.py index f413351b4..a39638559 100644 --- a/pyGHDL/dom/_Utils.py +++ b/pyGHDL/dom/_Utils.py @@ -59,10 +59,19 @@ def CheckForErrors() -> None: errors = [] if errorCount != 0: for i in range(errorCount): - errors.append(errorout_memory.Get_Error_Message(i + 1)) - - raise DOMException("Error raised in libghdl.") \ - from LibGHDLException("libghdl: Internal error.", errors) + rec = errorout_memory.Get_Error_Record(i + 1) + fileName = name_table.Get_Name_Ptr(files_map.Get_File_Name(rec.file)) + message = errorout_memory.Get_Error_Message(i + 1) + + errors.append( + "{file}:{line}:{column}: {msg}".format( + file=fileName, line=rec.line, column=rec.offset, msg=message + ) + ) + + raise DOMException("Error raised in libghdl.") from LibGHDLException( + "libghdl: Internal error.", errors + ) @export |