epiverse-trace / serofoi

Estimates the Force-of-Infection of a given pathogen from population based sero-prevalence studies
https://epiverse-trace.github.io/serofoi/
Other
17 stars 4 forks source link

Should `plot_()` functions fail when receiving an invalid object? #136

Closed Bisaloo closed 8 months ago

Bisaloo commented 11 months ago

At the moment and as far as I can tell, plot_() functions will print a message "model did not run" and return an empty plot when receiving an invalid seromodel_object (i.e., without samples).

In general, it is recommend to explicitly use stop() when the input is invalid rather than a warning and an empty output.

What do you think is the correct behaviour here?

ntorresd commented 11 months ago

Returning an empty plot was an early approach we were using from the beginning for this, but I think it would be way cleaner just to use stop() when the input is invalid.