improve not-found error message in list_directory_v2

Errors that say "something went wrong" should provide
context about what went wrong

PiperOrigin-RevId: 238462844
This commit is contained in:
A. Unique TensorFlower 2019-03-14 09:56:46 -07:00 committed by TensorFlower Gardener
parent 6859fefa3b
commit b3975ae622

View File

@ -646,7 +646,10 @@ def list_directory_v2(path):
errors.NotFoundError if directory doesn't exist
"""
if not is_directory(path):
raise errors.NotFoundError(None, None, "Could not find directory")
raise errors.NotFoundError(
node_def=None,
op=None,
message="Could not find directory {}".format(path))
with errors.raise_exception_on_not_ok_status() as status:
# Convert each element to string, since the return values of the
# vector of string should be interpreted as strings, not bytes.