Skip to content

Include property value in the error message#389

Merged
raymondfeng merged 2 commits into
masterfrom
feature/include-value-in-validation-error-message
Jan 14, 2015
Merged

Include property value in the error message#389
raymondfeng merged 2 commits into
masterfrom
feature/include-value-in-validation-error-message

Conversation

@bajtos

@bajtos bajtos commented Jan 12, 2015

Copy link
Copy Markdown
Member

When building a list of errors for ValidationError.message, include
the values of invalid properties too.

In order to keep the message reasonably short, the values are truncated
at approx 32 characters.

See the unit-tests for examples of error messages.

Supersedes #368.
A part of strongloop/strong-arc#562

/to @raymondfeng @bitmage please review
/cc @fabien @ritch FYI

Miroslav Bajtoš added 2 commits January 12, 2015 17:12
When building a list of errors for `ValidationError.message`, include
the values of invalid properties too.

In order to keep the message reasonably short, the values are truncated
at approx 32 characters.
Return the raw object data when running on Node v0.11.14+
That way all `inspect` options are always preserved.

When running on older version:
 - Honour the depth argument passed to the custom `inspect` function.
 - Disable color output, becase there is now way how to detect whether
   colors were enabled or disabled by the top-level caller.
@bajtos
bajtos force-pushed the feature/include-value-in-validation-error-message branch from 2df900f to e4fc387 Compare January 12, 2015 16:12
@bitmage

bitmage commented Jan 14, 2015

Copy link
Copy Markdown
Contributor

Awesome! I'm just happy that I'll have the values present for troubleshooting. Thanks for your work!

@bajtos

bajtos commented Jan 14, 2015

Copy link
Copy Markdown
Member Author

@raymondfeng ping

@bajtos

bajtos commented Jan 14, 2015

Copy link
Copy Markdown
Member Author

@slnode test please

raymondfeng added a commit that referenced this pull request Jan 14, 2015
…dation-error-message

Include property value in the error message
@raymondfeng
raymondfeng merged commit a2b5d64 into master Jan 14, 2015
@bajtos
bajtos deleted the feature/include-value-in-validation-error-message branch January 15, 2015 07:08
@bajtos bajtos assigned bajtos and unassigned raymondfeng Jan 15, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants