This is copied verbatim from notebook-dir, we raise TraitError when trait values are invalid.