Add begin/rescue block to POST /tasks to handle validation error