Skip to content

Commit

Permalink
Always catch exception when variable not present in file
Browse files Browse the repository at this point in the history
This probably either means an old output file, or some variable that is
not always written out (e.g. the PI controller integral terms). Neither
of these is a bug/issue that needs fixing, so makes sense to catch the
error and continue even if `handle_errors = false` is set in the
post-processing input file.
  • Loading branch information
johnomotani committed Jan 29, 2025
1 parent 58e3cf1 commit e1dcf65
Showing 1 changed file with 9 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,15 @@ function plots_for_variable(run_info, variable_name; plot_prefix, has_rdim=true,
try
variable = get_variable(run_info, variable_name)
catch e
return makie_post_processing_error_handler(
e,
"plots_for_variable() failed for $variable_name - could not load data.")
if isa(e, KeyError)
println("Key $(e.key) not found when loading $variable_name - probably not "
* "present in output")
return nothing
else
return makie_post_processing_error_handler(
e,
"plots_for_variable() failed for $variable_name - could not load data.")
end
end

if variable_name em_variables
Expand Down

0 comments on commit e1dcf65

Please sign in to comment.