returns error message if user creates post with wrong data type