timjmiller / wham

State-space, age-structured fish stock assessment model
https://timjmiller.github.io/wham
Other
32 stars 16 forks source link

error reporting within fit_wham and fit_tmb #45

Closed timjmiller closed 3 years ago

timjmiller commented 3 years ago

If an object named "err" exists in the global environment, it is found by exists() here and assigned to the model even when no error is found using the earlier tryCatch(). It also returns an error in the if statement because rm("err") only works locally.

exists("err", inherits = FALSE) might be the fix.

timjmiller commented 3 years ago

the tryCatch statement in fit_tmb puts the err object in the global environment. This seems to be unintended.

timjmiller commented 3 years ago

I have fixed error object location issues where tryCatch is used in fit_tmb, fit_wham, and project_wham on devel branch. Waiting until merged with master to close the issue.