Protect value() from exceptions.

Return undefined instead of throwing an exception.