stan-dev / posteriordb

Database with posteriors of interest for Bayesian inference
163 stars 26 forks source link

Guard reference access #204

Closed gbdrt closed 3 years ago

gbdrt commented 3 years ago

Hello,

I realized that access to the reference should be guarded since these references are not available for the entire database. Here is a proposal using simple assertion (similar to what is used elsewhere in the project).

This is to avoid weird type error when the file is missing. E.g.:

TypeError: unsupported operand type(s) for +: 'NoneType' and 'str'

and get an assertion error on assert reference_name is not None instead.

MansMeg commented 3 years ago

Hi!

Thanks. This looks great.