Added error handling to pet creation