Skip to content

Commit dcb6d02

Browse files
refactor(parametricbuilder): improve error reporting and output formatting in SystemBuilderSpec
1 parent b056f84 commit dcb6d02

1 file changed

Lines changed: 10 additions & 5 deletions

File tree

src/parametricbuilder/base.jl

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,12 @@ function Base.iterate(spec::SystemBuilderSpec)
199199
x = take!(ch);
200200
return (x, ch)
201201
catch
202-
return nothing
202+
@error "SystemBuilderSpec iteration failed before first yield" exception=(
203+
e,
204+
catch_backtrace(),
205+
)
206+
207+
rethrow()
203208
end
204209
end
205210

@@ -259,8 +264,8 @@ function Base.show(io::IO, ::MIME"text/plain", spec::SystemBuilderSpec)
259264
for (i, p) in enumerate(spec.positions)
260265
dxvals = _vals_axis(p.x0, p.dx)
261266
dyvals = _vals_axis(p.y0, p.dy)
262-
println(io, " • p", i, " x: ", _fmt_vals(dxvals), " y: ", _fmt_vals(dyvals),
263-
" phases {", _fmt_map(p.conn), "}")
267+
println(io, " • p", i, " x: ", _fmt_vals(dxvals), ", y: ", _fmt_vals(dyvals),
268+
", phases: {", _fmt_map(p.conn), "}")
264269
end
265270

266271
# system scalars
@@ -277,8 +282,8 @@ function Base.show(io::IO, ::MIME"text/plain", spec::SystemBuilderSpec)
277282
# frequencies (deterministic vector coming from the user/spec)
278283
if hasfield(SystemBuilderSpec, :frequencies) && !isempty(getfield(spec, :frequencies))
279284
f = getfield(spec, :frequencies)
280-
println(io, " f = ", _fmt_freqs(f))
285+
println(io, " f = ", _fmt_freqs(f))
281286
end
282287

283-
println(io, " ⇒ total cardinality (upper bound): ", cardinality(spec))
288+
println(io, " cardinality (upper bound): ", cardinality(spec))
284289
end

0 commit comments

Comments
 (0)