Update validator.js to support error object data attribute