error handling for failed requests, 412 instead of 500