Made the api throw http statuts code 400 on error.