Additional error checking for typlib::Value

Originally submitted by @jmachowinski as https://gitorious.org/orocos-toolchain/typelib/merge_requests/3.