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

Throws error when field is missing and abortEarly=false #184

Closed
AndrewKeig opened this issue Feb 19, 2014 · 1 comment
Closed

Throws error when field is missing and abortEarly=false #184

AndrewKeig opened this issue Feb 19, 2014 · 1 comment
Assignees
Labels
bug Bug or defect
Milestone

Comments

@AndrewKeig
Copy link

Hey,

The below throws an error, this should return :

'the value of username is not allowed to be undefined'

var Joi = require('joi');

var schema = {
  username: Joi.string().required().email()
};

var error = Joi.validate({}, schema, {abortEarly : false});

console.log(error);

Throws the following error:

joi/lib/string.js:168
        if (value.match(regex)) {
                  ^
TypeError: Cannot call method 'match' of undefined

This will also throw an error

var Joi = require('joi');

var schema = {
  password: Joi.string().required().min(6).max(10)
};

var error = Joi.validate({}, schema, {abortEarly : false});

console.log(error);

Produces the following error:

joi/lib/string.js:75
            value.length <= limit) {
                 ^
TypeError: Cannot read property 'length' of undefined
@hueniverse hueniverse added the bug label Mar 10, 2014
@hueniverse hueniverse added this to the 2.8.0 milestone Mar 10, 2014
@hueniverse hueniverse self-assigned this Mar 10, 2014
@AndrewKeig
Copy link
Author

Sweet..

@lock lock bot locked as resolved and limited conversation to collaborators Jan 11, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Bug or defect
Projects
None yet
Development

No branches or pull requests

2 participants