New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error when trying to validate sub attribute of null #17

Closed
javve opened this Issue Jan 8, 2015 · 3 comments

Comments

Projects
None yet
2 participants
@javve

javve commented Jan 8, 2015

I have a constraint looking like this:

  'copy.primaryColor':
    format:
      pattern: "^#(?:[0-9a-f]{3}){1,2}$"
      flags: "i"
      message: "must be a valid hex color"

The problem is that everything breaks if copy is null.

TypeError: Cannot use 'in' operator to search for 'primaryColor' in null
  at Function.v.extend.getDeepObjectValue (/Users/javve/Git/confetti/confetti-api/node_modules/validate.js/validate.js:310:18)
  at Function.v.extend.runValidations (/Users/javve/Git/confetti/confetti-api/node_modules/validate.js/validate.js:66:19)
  at Function.v.extend.async (/Users/javve/Git/confetti/confetti-api/node_modules/validate.js/validate.js:129:23)
@ansman

This comment has been minimized.

Show comment
Hide comment
@ansman

ansman Jan 10, 2015

Owner

Interesting, I'll take a closer look when I'm back from vacation

On Thu, Jan 8, 2015 at 10:50 PM, Jonny Strömberg notifications@github.com
wrote:

I have a constraint looking like this:

  'copy.primaryColor':
    format:
      pattern: "^#(?:[0-9a-f]{3}){1,2}$"
      flags: "i"
      message: "must be a valid hex color"

The problem is that everything breaks if copy is null.

TypeError: Cannot use 'in' operator to search for 'primaryColor' in null
  at Function.v.extend.getDeepObjectValue (/Users/javve/Git/confetti/confetti-api/node_modules/validate.js/validate.js:310:18)
  at Function.v.extend.runValidations (/Users/javve/Git/confetti/confetti-api/node_modules/validate.js/validate.js:66:19)
  at Function.v.extend.async (/Users/javve/Git/confetti/confetti-api/node_modules/validate.js/validate.js:129:23)

Reply to this email directly or view it on GitHub:
#17

Owner

ansman commented Jan 10, 2015

Interesting, I'll take a closer look when I'm back from vacation

On Thu, Jan 8, 2015 at 10:50 PM, Jonny Strömberg notifications@github.com
wrote:

I have a constraint looking like this:

  'copy.primaryColor':
    format:
      pattern: "^#(?:[0-9a-f]{3}){1,2}$"
      flags: "i"
      message: "must be a valid hex color"

The problem is that everything breaks if copy is null.

TypeError: Cannot use 'in' operator to search for 'primaryColor' in null
  at Function.v.extend.getDeepObjectValue (/Users/javve/Git/confetti/confetti-api/node_modules/validate.js/validate.js:310:18)
  at Function.v.extend.runValidations (/Users/javve/Git/confetti/confetti-api/node_modules/validate.js/validate.js:66:19)
  at Function.v.extend.async (/Users/javve/Git/confetti/confetti-api/node_modules/validate.js/validate.js:129:23)

Reply to this email directly or view it on GitHub:
#17

@javve

This comment has been minimized.

Show comment
Hide comment
@javve

javve Jan 11, 2015

👍 ✌️

javve commented Jan 11, 2015

👍 ✌️

@ansman ansman closed this in 892328a Jan 20, 2015

@javve

This comment has been minimized.

Show comment
Hide comment
@javve

javve Jan 21, 2015

WOHO! ❤️

javve commented Jan 21, 2015

WOHO! ❤️

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment