Skip to content
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

validations: include more details in err.message #116

Merged
merged 1 commit into from
May 20, 2014

Conversation

bajtos
Copy link
Member

@bajtos bajtos commented May 20, 2014

Modify ValidationError constructor to include the model name and
a human-readable representation of the validation errors (messages)
in the error message.

Before this change, the message was pointing the reader
to err.details. Most frameworks (e.g. express, mocha) log only
err.message but not other error properties, thus the logs were
rather unhelpful.

Example of the new error message:

The `User` instance is not valid. Details: `name` can't be blank.

/to @ritch or @raymondfeng please review

Modify ValidationError constructor to include the model name and
a human-readable representation of the validation errors (messages)
in the error message.

Before this change, the message was pointing the reader
to `err.details`.  Most frameworks (e.g. express, mocha) log only
`err.message` but not other error properties, thus the logs were
rather unhelpful.

Example of the new error message:

    The `User` instance is not valid. Details: `name` can't be blank.
@slnode
Copy link

slnode commented May 20, 2014

All is well
Refer to this link for build results: http://ci.strongloop.com/job/loopback-datasource-juggler/432/

@raymondfeng
Copy link
Contributor

LGTM.

Great timing as I just ran into the same issue yesterday.

bajtos added a commit that referenced this pull request May 20, 2014
…ror-toString

validations: include more details in `err.message`
@bajtos bajtos merged commit 8b29ad0 into master May 20, 2014
@bajtos bajtos deleted the feature/improve-validation-error-toString branch May 20, 2014 15:46
@ritch
Copy link
Contributor

ritch commented May 20, 2014

Nice.

@bajtos
Copy link
Member Author

bajtos commented May 20, 2014

Released as 1.5.2

@slnode
Copy link

slnode commented May 20, 2014

All is well
Refer to this link for build results: http://ci.strongloop.com/job/loopback-datasource-juggler/435/

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