NOAA-FIMS / FIMS

The repository for development of FIMS
https://noaa-fims.github.io/FIMS/
GNU General Public License v3.0
14 stars 9 forks source link

[Feature]: add error handling for initialization errors #346

Open ChristineStawitz-NOAA opened 1 year ago

ChristineStawitz-NOAA commented 1 year ago

Is your feature request related to a problem? Please describe.

Right now if you don't set some of the R fields properly the model will segfault, and it would be better for the user to get an error describing why the model is failing.

Describe the solution you would like.

right now the program segfaults if things are not properly set, it would be better to provide informative error messages

Describe alternatives you have considered

current approach

Statistical validity, if applicable

No response

Describe if this is needed for a management application

No response

Additional context

No response

Code of Conduct

k-doering-NOAA commented 1 year ago

@ChristineStawitz-NOAA do you think the error handling should take place on the R side or the C++ side? If it is the R side, it may be possible to check when creating the S4 objects (which is part of the S4 framework).

Andrea-Havron-NOAA commented 1 year ago

Currently FIMS checks for missing modules on the C++ side (example here). This error checking step in C++ is invoked when calling MakeADFun(). Any segfault error (e.g. missing module, dimension mismatch, etc.) would crash the R session. Segfault related errors will require error handling on the R side to avoid R session crashes.

Andrea-Havron-NOAA commented 1 year ago

Related to Issue #314

msupernaw commented 1 year ago

The easiest place to catch model configuration errors would be in the Information::CreateModel method.

On Mon, Jul 17, 2023 at 6:01 PM Andrea-Havron-NOAA @.***> wrote:

Related to Issue #314 https://github.com/NOAA-FIMS/FIMS/issues/314

— Reply to this email directly, view it on GitHub https://github.com/NOAA-FIMS/FIMS/issues/346#issuecomment-1638945492, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABFUSEACSWLVSIXG3DTJN5DXQWY2JANCNFSM6AAAAAAWVQ7NYM . You are receiving this because you are subscribed to this thread.Message ID: @.***>

-- Matthew Supernaw Scientific Software Developer National Oceanic and Atmospheric Administration Office Of Science and Technology NOAA Fisheries | U.S. Department of Commerce Phone 248 - 396 - 7797

Andrea-Havron-NOAA commented 1 year ago

In addition to catching model configuration errors with CreateModel, we will want additional error checks on the R side to catch potential segfaults before MakeADFun is called.

ChristineStawitz-NOAA commented 5 months ago

Tagging as this is coming up in a lot of case studies, particularly the need to validate dimensions of input parameters