Skip to content

Checking for invalid switch selections? #53

@jimc101

Description

@jimc101

In ERSEM, switches are often used to select which bits of code are actually run. For example, when computing oxygen saturation concentrations, there is a choice between "legacy ERSEM" and "Weiss 1970". The former can be selected using a value of 1 and the latter a value of 2 according to the module documentation. If a value other than 1 or 2 is specified, it would be reasonable to expect the model to halt with an error message stating that an incorrect selection has been made. In-fact, this doesn't happen. Rather, nearly all this switches are implemented with if - elseif - else syntax, with the else catching the final option. However, the user has no way of knowing this, and it would be better if ERSEM did indeed check for invalid configuration options. It looks like FABM includes a procedure for invoking fatal errors. Is there an overhead/issue with invoking this when selecting between cases? Even if there is, I figure one could implement a workaround (e.g. only perform the check during module initialisation).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions