From b3975ae6225f107f3a3ffffdbd78d6443baa48c8 Mon Sep 17 00:00:00 2001 From: "A. Unique TensorFlower" Date: Thu, 14 Mar 2019 09:56:46 -0700 Subject: [PATCH] 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 --- tensorflow/python/lib/io/file_io.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/tensorflow/python/lib/io/file_io.py b/tensorflow/python/lib/io/file_io.py index 2720962084b..e80178b2d90 100644 --- a/tensorflow/python/lib/io/file_io.py +++ b/tensorflow/python/lib/io/file_io.py @@ -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.