webplot: add back the IO Error handling when saving an image file
The IO error handling was erased accidentally. This simple patch
just adds it back.
BUG=chromium:476833
TEST=Manually verified it.
Change-Id: I842d45e379605d20fbe5e666abea8071da3fefef
Reviewed-on: https://chromium-review.googlesource.com/266626
Reviewed-by: Charlie Mooney <charliemooney@chromium.org>
Tested-by: Shyh-In Hwang <josephsih@chromium.org>
Commit-Queue: Shyh-In Hwang <josephsih@chromium.org>
diff --git a/webplot/webplot.py b/webplot/webplot.py
index 79fa339..271ce18 100755
--- a/webplot/webplot.py
+++ b/webplot/webplot.py
@@ -143,8 +143,12 @@
global image_string
image_string = base64.b64decode(image_data)
image_lock.set()
- with open(image_file, 'w') as f:
- f.write(image_string)
+ try:
+ with open(image_file, 'w') as f:
+ f.write(image_string)
+ except IOError as e:
+ _IOError(e, image_file)
+ state.QuitAndShutdown()
class ConnectionState(object):