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);
fork icon49
star icon182
watch icon65

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 = {
fork icon24
star icon0
watch icon5

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) {
fork icon22
star icon75
watch icon6

+ 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) {
fork icon20
star icon11
watch icon35

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();
})
fork icon11
star icon33
watch icon5

+ 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;
     }
fork icon4
star icon0
watch icon0

+ 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;
fork icon0
star icon0
watch icon0

+ 3 other calls in file