Commit 7c53bc7f authored by Yong Tang's avatar Yong Tang Committed by Rasmus Munk Larsen
Browse files

Propagate the error string of GIF processing for decode_gif (#16113)



* Propagate the error message to exception of `InvalidArgumentError` for `decode_gif`

This fix tries to improve the error thrown by `decode_gif`
to include the error string generated by GIF processing.

Previously, the error was not very indicative as the error string
returned by GIF processing was hidden:
```
..........
InvalidArgumentError (see above for traceback): Invalid GIF data, size 2091369
	 [[Node: DecodeGif = DecodeGif[_device="/job:localhost/replica:0/task:0/device:CPU:0"](ReadFile)]]
```

This fix propagate the error string to be part of the `InvalidArgumentError`:
```
InvalidArgumentError (see above for traceback): Invalid GIF data (size 2091369), can't process optimized gif
         [[Node: DecodeGif = DecodeGif[_device="/job:localhost/replica:0/task:0/device:CPU:0"](ReadFile)]]
```

This fix fixes 15838.

Signed-off-by: default avatarYong Tang <yong.tang.github@outlook.com>

* Reformat with clang-format -i --style=Google

Signed-off-by: default avatarYong Tang <yong.tang.github@outlook.com>

* Add unit test for decode_gif to cover changes

so that error messages like `can't process optimized gif` are
propagated to the exception of `InvalidArgumentError`.

Signed-off-by: default avatarYong Tang <yong.tang.github@outlook.com>
parent a73a6cff
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment