Skip to content

Commit

Permalink
improve error message for #1136
Browse files Browse the repository at this point in the history
Raise a DXFStructure error for missing or invalid BLOCK names.
  • Loading branch information
mozman committed Jul 31, 2024
1 parent 02c9a12 commit 750e00f
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/ezdxf/sections/blocks.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
DXFKeyError,
DXFStructureError,
DXFTableEntryError,
DXFTypeError,
)
from ezdxf.entities import (
Attrib,
Expand Down Expand Up @@ -128,7 +129,10 @@ def load_block_record(
"BlockRecord",
block_records.new(block.dxf.name, dxfattribs={"scale": 0}),
)

except DXFTypeError:
raise DXFStructureError(
f"Invalid or missing name of BLOCK #{block.dxf.handle}"
)
# The BLOCK_RECORD is the central object which stores all the
# information about a BLOCK and also owns all the entities of
# this block definition.
Expand Down

0 comments on commit 750e00f

Please sign in to comment.