stan-dev / stan

Stan development repository. The master branch contains the current release. The develop branch contains the latest stable development. See the Developer Process Wiki for details.
https://mc-stan.org
BSD 3-Clause "New" or "Revised" License
2.56k stars 366 forks source link

Service functions: Consistent exception handling and error logging #3214

Closed WardBrian closed 1 year ago

WardBrian commented 1 year ago

Submission Checklist

Summary

Currently, the services functions are inconsistent on whether or not they will throw an exception. The versions which accept num_chains should never throw, but the older ones will throw if initialization fails. This consistently puts utils::initialize in a try block.

Additionally, we are currently using logger.info for messages which are errors, and in several places not logging an error where we could (e.g., the catch blocks accompanying the above trys).

Intended Effect

Improved error logging and exception safety in the services functions

How to Verify

Side Effects

Documentation

Copyright and Licensing

Please list the copyright holder for the work you are submitting (this will be you or your assignee, such as a university or company):

Simons Foundation

By submitting this pull request, the copyright holder is agreeing to license the submitted work under the following licenses: