Skip to content

better default exception check in hook #2

@richardo2016

Description

@richardo2016
// valid check, hook would throw exception
beforeCreate: function (next) {
    let err = null

    err = someCheck()
    if (err && err.message)
        return next(new Error(err.message))
}
// invalid check, hook would throw one lonely message 'undefined' only
beforeCreate: function (next) {
    let err = null

    err = someCheck()
    if (err && err.message)
        return next(err.message)
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions