Throw NotFound and CannotDereferenceToCommitExceptions

This change is to throw more specific exceptions in several cases when
possible. If an object cannot be found, throw a more specific
NotFoundException. If an object exists but cannot be dereferenced to a
commit when requested, then throw a CannotDereferenceToCommitException.