throw error if input not string type