Skip to content

Commit 297044a

Browse files
feat: add check_complete
1 parent ca3fe26 commit 297044a

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

src/systems/system.jl

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -286,6 +286,24 @@ function _check_if_dde(eqs, iv, subsystems)
286286
return is_dde
287287
end
288288

289+
"""
290+
$(TYPEDSIGNATURES)
291+
"""
292+
function check_complete(sys::System, obj)
293+
iscomplete(sys) || throw(SystemNotCompleteError(obj))
294+
end
295+
296+
struct SystemNotCompleteError <: Exception
297+
obj::Any
298+
end
299+
300+
function Base.showerror(io::IO, err::SystemNotCompleteError)
301+
print(io, """
302+
A completed system is required. Call `complete` or `structural_simplify` on the \
303+
system before creating a `$(err.obj)`.
304+
""")
305+
end
306+
289307
struct IllFormedNoiseEquationsError <: Exception
290308
noise_eqs_rows::Int
291309
eqs_length::Int

0 commit comments

Comments
 (0)