Fixed error handling when status code is not 200.

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