Added error message json when returning a status code other than a successful one