How to use the MissingParameterError function from restify
Find comprehensive JavaScript restify.MissingParameterError code examples handpicked from public code repositorys.
20 21 22 23 24 25 26 27 28 29
var operation = req.app.sockets.getSocket('job', id); if (!id || !operation) { return next(new restify.ResourceNotFoundError('Operation not found')); } else if (!payload) { return next(new restify.MissingParameterError('Missing payload')); } operation.socket.write(JSON.stringify(payload)); res.send(200);
49
182
65
GitHub: eait-itig/sdc-cloudapi
15 16 17 18 19 20 21 22 23 24
var util = require('util'); var restify = require('restify'); var resources = require('./resources'); var MissingParameterError = restify.MissingParameterError; var InvalidArgumentError = restify.InvalidArgumentError; function translate(rule) { var r = {
24
0
5
72 73 74 75 76 77 78 79 80 81
return next(); } function post_message(req, res, next) { if(!req.body.author || !req.body.text || !req.body.thread) { return next(new restify.MissingParameterError("Missing required message attribute in request body")); } Thread.findOne({_id: req.body.thread}, function(err, thread) { if (err) {
22
75
6
+ 3 other calls in file
24 25 26 27 28 29 30 31 32 33
function listStatuses(req, res, next) { req.log.trace('ListStatuses start'); var uuids = req.params.uuids; if (!uuids) { return next(new restify.MissingParameterError('uuids is required')); } return req.app.moray.getVms(uuids.split(','), function (err, vms) { if (err) {
20
11
35
65 66 67 68 69 70 71 72 73
} // password not blank when creating, otherwise skip if (!this.isNew) return next(); if (!validatePresenceOf(this.password)) { next(new restify.MissingParameterError('Invalid password')); } next(); })
11
33
5
+ 11 other calls in file
279 280 281 282 283 284 285 286 287 288
@@ -221,18 +225,19 @@ Instances.upgrade = function (req, res, next) { var image_uuid = req.params.image_uuid; if (!image_uuid) { - return (next(new restify.MissingParameterError( - 'missing image_uuid'))); + next(new restify.MissingParameterError('missing image_uuid')); + return; }
4
0
0
+ 3 other calls in file
43 44 45 46 47 48 49 50 51 52
} return error; } function MissingParameterError(msg , outMsg){ var error = new restify.MissingParameterError(msg); if(outMsg){ error.body.outMsg = outMsg; } return error;
0
0
0
+ 3 other calls in file
restify.createServer is the most popular function in restify (1059 examples)