Throw NotFound and CannotDereference Exceptions - Reborn

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 its
desired type, then throw a CannotDereferenceException.

This is the rebirth of #839 that has been too hastily merged (then reverted). :blush: