improved error handling of 40* errors so that message is passed on from json response, if available