Skip to content

Improve error message when validation.payload is set but type is GET #2347

Description

@wraithan

Currently you get an error looking like:

/Users/wraithan/devel/javascript/alert-alpaca/node_modules/hapi/lib/route.js:126
Hoek.assert(!this.settings.validate.payload || this.settings.payload.parse, 'R
                                                                    ^
TypeError: Cannot read property 'parse' of null
    at new module.exports.internals.Route (/Users/wraithan/devel/javascript/alert-alpaca/node_modules/hapi/lib/route.js:126:73)
    at internals.Connection._addRoute (/Users/wraithan/devel/javascript/alert-alpaca/node_modules/hapi/lib/connection.js:344:17)
    at internals.Connection._route (/Users/wraithan/devel/javascript/alert-alpaca/node_modules/hapi/lib/connection.js:336:18)
    at internals.Plugin._apply (/Users/wraithan/devel/javascript/alert-alpaca/node_modules/hapi/lib/plugin.js:432:14)
    at internals.Plugin.route (/Users/wraithan/devel/javascript/alert-alpaca/node_modules/hapi/lib/plugin.js:407:10)
    at Object.<anonymous> (/Users/wraithan/devel/javascript/alert-alpaca/index.js:7:8)
    at Module._compile (module.js:456:26)
    at Object.Module._extensions..js (module.js:474:10)
    at Module.load (module.js:356:32)
    at Function.Module._load (module.js:312:12)

It looks like there used to be a nicer error that was removed in a refactor:

4299e9e#diff-f34e409694d3ba334dabbea190f64c1dL117

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bugBug or defect

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions