Skip to content

Commit

Permalink
overwrite duplicate diags
Browse files Browse the repository at this point in the history
  • Loading branch information
juliasloan25 committed Feb 23, 2024
1 parent 3ecdff1 commit e014e55
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/diagnostics/diagnostic.jl
Original file line number Diff line number Diff line change
Expand Up @@ -152,8 +152,14 @@ function add_diagnostic_variable!(;
comments = "",
compute!,
)
haskey(ALL_DIAGNOSTICS, short_name) &&
error("diagnostic $short_name already defined")
haskey(ALL_DIAGNOSTICS, short_name) && @warn(
"overwriting diagnostic `$short_name` entry containing fields\n" *
"$(map(
fieldname -> "$(getfield(ALL_DIAGNOSTICS[short_name], fieldname))",
fieldnames(DiagnosticVariable)[1:(end - 1)],
))"
)


ALL_DIAGNOSTICS[short_name] = DiagnosticVariable(;
short_name,
Expand Down

0 comments on commit e014e55

Please sign in to comment.