Parse errors for failed uploads

And return error accordingly