Fixed error handling of uploading

Signed-off-by: Kouhei Maeda <mkouhei@palmtb.net>