pathfinder-for-autonomous-navigation / psim

Six DOF flight simulator and related GNC implementations.
MIT License
4 stars 6 forks source link

Improve State Field and Parameter Error Messages #232

Closed kylekrol closed 3 years ago

kylekrol commented 3 years ago

@tanishqaggarwal raised a concern that some of the errors messages produced by failed state field/parameter casts are not very informative:

auto *field_ptr = dynamic_cast<StateField<T> *>(this);
if (!field_ptr)
  throw std::runtime_error("Invalid field type in call to 'cast'.");

It would be far superior if this message reported the name of the field the cast failed on. To implement this, we need to tie a string name to the field/parameter itself as opposed to the state entry. This will involve a non-trivial amount of refactoring but shouldn't affect existing model implementations.