Re: Review: Add config.sanityCheck


Jeremy Selan <jeremy...@...>
 

Either of our approaches will work, of course, but I'm still inclined
to go with the exception route.

A bunch of calls in OCIO can throw exceptions (the common one being
config->getProcessor(...) ), so most of the time you'll already have
try / catch blocks. You can usually thus add a "sanityCheck" call in
a single extra line.

If we instead added: bool isValid(const char * msg)
this requires a separate code block to explicitly check it, probably 3
or 4 lines of code. Which isn't a problem, just an observation.

I'm also not the biggest fan of functions with two return arguments.
Consider the python API... If we go the exception route, it ports
naturally. If we use an isValid call, would it return the tuple
"(bool, str)"? People would probably expect it to just return a bool.

Perhaps you object to the name 'sanityCheck'? (Which I admit is a bit
weird). How about 'validate', instead?

OCIO::GetCurrentConfig() will always return a valid profile object.
It currently will throw an exception only iff $OCIO is defined, but
points to a profile that has parse problems.

I'd prefer to not enforce 'auto validation' after loading at the library level.

-- Jeremy

Join {ocio-dev@lists.aswf.io to automatically receive all group messages.