Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
public
/
sequelize
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
不要怂,就是干,撸起袖子干!
Commit 602110f0
authored
Nov 04, 2017
by
Sushant
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
docs: improve ValidationErrorItem docs
1 parent
28c6574d
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
50 additions
and
3 deletions
lib/errors/index.js
lib/errors/index.js
View file @
602110f
...
...
@@ -37,7 +37,7 @@ exports.SequelizeScopeError = SequelizeScopeError;
* @param {string} message Error message
* @param {Array} [errors] Array of ValidationErrorItem objects describing the validation errors
*
* @property errors
An array of ValidationErrorItems
* @property errors
{ValidationErrorItems[]}
*/
class
ValidationError
extends
BaseError
{
constructor
(
message
,
errors
)
{
...
...
@@ -234,20 +234,65 @@ exports.UnknownConstraintError = UnknownConstraintError;
* @param {Object} [validatorKey] a validation "key", used for identification
* @param {String} [fnName] property name of the BUILT-IN validator function that caused the validation error (e.g. "in" or "len"), if applicable
* @param {String} [fnArgs] parameters used with the BUILT-IN validator function, if applicable
*
* @param {string} value The value that generated the error
*/
class
ValidationErrorItem
{
constructor
(
message
,
type
,
path
,
value
,
inst
,
validatorKey
,
fnName
,
fnArgs
)
{
/**
* An error message
*
* @type {String} message
*/
this
.
message
=
message
||
''
;
/**
* The type/origin of the validation error
*
* @type {String}
*/
this
.
type
=
null
;
/**
* The field that triggered the validation error
*
* @type {String}
*/
this
.
path
=
path
||
null
;
/**
* The value that generated the error
*
* @type {String}
*/
this
.
value
=
value
!==
undefined
?
value
:
null
;
this
.
origin
=
null
;
/**
* The DAO instance that caused the validation error
*
* @type {Model}
*/
this
.
instance
=
inst
||
null
;
/**
* A validation "key", used for identification
*
* @type {String}
*/
this
.
validatorKey
=
validatorKey
||
null
;
/**
* Property name of the BUILT-IN validator function that caused the validation error (e.g. "in" or "len"), if applicable
*
* @type {String}
*/
this
.
validatorName
=
fnName
||
null
;
/**
* Parameters used with the BUILT-IN validator function, if applicable
*
* @type {String}
*/
this
.
validatorArgs
=
fnArgs
||
[];
if
(
type
)
{
...
...
@@ -278,6 +323,8 @@ class ValidationErrorItem {
* defaults to "." (fullstop). only used and validated if useTypeAsNS is TRUE.
* @throws {Error} thrown if NSSeparator is found to be invalid.
* @return {String}
*
* @private
*/
getValidatorKey
(
useTypeAsNS
,
NSSeparator
)
{
const
useTANS
=
typeof
useTypeAsNS
===
'undefined'
?
true
:
!!
useTypeAsNS
;
...
...
Write
Preview
Markdown
is supported
Attach a file
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to post a comment