Skip to content

Parameter errors name neither the parameter nor the material: bad any_cast, ignored keys, truncated numbers #65

Description

@petlenz

Several parameter mistakes produce either an unusable message or none at all.

Mistake What happens
int where a double is expected (C++ path) bare std::bad_any_cast, names nothing
misspelt optional key (C++ path) silently ignored; the JSON path warns
"max_iter": 7.9 silently truncated to 7
missing required parameter C++: names one of several; JSON: names none. Never names the material

numsim-core already provides check_data_type (-> Parameter 'K' has wrong type) and range<Min, Max>. No material uses either.

Fix

  • attach check_data_type when a parameter is declared, so it applies to every material at once rather than per material;
  • reject unknown keys in the C++ path the same way the JSON path warns;
  • reject a non-integral value for an integer parameter;
  • wrap parameter errors at the material boundary so the message carries the material name and type (numsim-core cannot know these). The missing-names half is tracked in Missing-parameter error reports a count, not the parameter names numsim-core#20.

All references are to main at 91bd26f.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions