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:
Yong Tang <yong.tang.github@outlook.com>
* Reformat with clang-format -i --style=Google
Signed-off-by:
Yong 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:
Yong Tang <yong.tang.github@outlook.com>
Loading
Please sign in to comment