Added error handling code for postSolution.