Formats error messages, calls the callback
@method done
@private
@param cb {Function} callback
@param [message] {Function} callback
@return {Boolean} is the object valid or not?
548886
function _done (cb, message) {
  var valid = false

  if (typeof message === 'string') {
    message = [message]
  } else if (Object.prototype.toString.call(message) === '[object Array]') {
    if (message.length === 0) {
      valid = true
    }
  } else {
    valid = true
  }

  if (isFunction(cb)) {
    if (valid) {
      cb(valid, [])
    } else {
      cb(valid, message)
    }
  }

  return valid
}
1044611
def make_call_with_cb(self, fun, *args):
        """"""

        cid, event = self.handler.register_callback()
        argscp = list(args)
        argscp.append(cid)
        self.make_call(fun, *argscp)
        return event
1189711
function onError(callback) {
  var code = (arguments.length > 1) ? arguments[1] : 0;
  fire('open.error', code);
  if (typeof callback === 'function') {
    callback(code);
  }
  return code;
}
1365280
function(callback) {
				// tell the user what we’re doing
				grunt.verbose.writeln('Validating options…');

				// make sure alpha is valid
				if (!validateAlpha(options.alpha)) {
					return grunt.fail.fatal('Invalid `alpha` option');
				}
				grunt.verbose.writeln('`alpha` option OK');

				// make sure background is valid
				if (!validateBackground(options.background)) {
					return grunt.fail.fatal('Invalid `background` option');
				}
				grunt.verbose.writeln('`background` option OK');

				// make sure colorspace is valid
				if (!validateColorspace(options.colorspace)) {
					return grunt.fail.fatal('Invalid `colorspace` option');
				}
				grunt.verbose.writeln('`colorspace` option OK');

				// make sure dither is valid
				if (!validateDither(options.dither)) {
					return grunt.fail.fatal('Invalid `dither` option');
				}
				grunt.verbose.writeln('`dither` option OK');

				// make sure filter is valid
				if (!validateFilter(options.filter)) {
					return grunt.fail.fatal('Invalid `filter` option');
				}
				grunt.verbose.writeln('`filter` option OK');

				// make sure filterSupport is valid
				if (!validateFilterSupport(options.filterSupport)) {
					return grunt.fail.fatal('Invalid `filterSupport` option');
				}
				grunt.verbose.writeln('`filterSupport` option OK');

				// make sure interlace is valid
				if (!validateInterlace(options.interlace)) {
					return grunt.fail.fatal('Invalid `interlace` option');
				}
				grunt.verbose.writeln('`interlace` option OK');

				// make sure jpegFancyUpsampling is valid
				if (!validateJpegFancyUpsampling(options.jpegFancyUpsampling)) {
					return grunt.fail.fatal('Invalid `jpegFancyUpsampling` option');
				}
				grunt.verbose.writeln('`jpegFancyUpsampling` option OK');

				// make sure optimize is valid
				var optimize = validateOptimize(options.optimize)
				if (!optimize) {
					return grunt.fail.fatal('Invalid `optimize` option');
				} else {
					options.optimize = optimize;
				}
				grunt.verbose.writeln('`optimize` option OK');

				// make sure image_optim is available
				if ((options.optimize.input.image_optim > 0 || options.optimize.output.image_optim > 0) && !binPath.image_optim) {
					return grunt.fail.fatal('Unable to locate image_optim.');
				} else if (options.optimize.input.image_optim > 0 || options.optimize.output.image_optim > 0) {
					grunt.verbose.writeln('image_optim located');
				} else {
					grunt.verbose.writeln('image_optim not needed');
				}

				// make sure picopt is available
				if ((options.optimize.input.picopt > 0 || options.optimize.output.picopt > 0) && !binPath.picopt) {
					return grunt.fail.fatal('Unable to locate picopt.');
				} else if (options.optimize.input.picopt > 0 || options.optimize.output.picopt > 0) {
					grunt.verbose.writeln('picopt located');
				} else {
					grunt.verbose.writeln('picopt not needed');
				}

				// make sure ImageOptim is available
				if ((options.optimize.input.imageOptim > 0 || options.optimize.output.imageOptim > 0) && !binPath.imageOptim) {
					return grunt.fail.fatal('Unable to locate ImageOptim-CLI.');
				} else if (options.optimize.input.imageOptim > 0 || options.optimize.output.imageOptim > 0) {
					grunt.verbose.writeln('ImageOptim-CLI located');
				} else {
					grunt.verbose.writeln('ImageOptim-CLI not needed');
				}

				// make sure pngCompressionFilter is valid
				if (!validatePngCompressionFilter(options.pngCompressionFilter)) {
					return grunt.fail.fatal('Invalid `pngCompressionFilter` option');
				}
				grunt.verbose.writeln('`pngCompressionFilter` option OK');

				// make sure pngCompressionLevel is valid
				if (!validatePngCompressionLevel(options.pngCompressionLevel)) {
					return grunt.fail.fatal('Invalid `pngCompressionLevel` option');
				}
				grunt.verbose.writeln('`pngCompressionLevel` option OK');

				// make sure pngCompressionStrategy is valid
				if (!validatePngCompressionStrategy(options.pngCompressionStrategy)) {
					return grunt.fail.fatal('Invalid `pngCompressionStrategy` option');
				}
				grunt.verbose.writeln('`pngCompressionStrategy` option OK');

				// make sure pngExcludeChunk is valid
				if (!validatePngExcludeChunk(options.pngExcludeChunk)) {
					return grunt.fail.fatal('Invalid `pngExcludeChunk` option');
				}
				grunt.verbose.writeln('`pngExcludeChunk` option OK');

				// make sure pngPreserveColormap is valid
				if (!validatePngPreserveColormap(options.pngPreserveColormap)) {
					return grunt.fail.fatal('Invalid `pngPreserveColormap` option');
				}
				grunt.verbose.writeln('`pngPreserveColormap` option OK');

				// make sure posterize is valid
				if (!validatePosterize(options.posterize)) {
					return grunt.fail.fatal('Invalid `posterize` option');
				}
				grunt.verbose.writeln('`posterize` option OK');

				// make sure quality is valid
				if (!validateQuality(options.quality)) {
					return grunt.fail.fatal('Invalid `quality` option');
				}
				grunt.verbose.writeln('`quality` option OK');

				// make sure resizeFunction is valid
				if (!validateResizeFunction(options.resizeFunction)) {
					return grunt.fail.fatal('Invalid `resizeFunction` option');
				}
				grunt.verbose.writeln('`resizeFunction` option OK');

				// make sure strip is valid
				if (!validateStrip(options.strip)) {
					return grunt.fail.fatal('Invalid `strip` option');
				}
				grunt.verbose.writeln('`strip` option OK');

				// make sure svgoPlugins is valid
				if (!validateSvgoPlugins(options.svgoPlugins)) {
					return grunt.fail.fatal('Invalid `svgoPlugins` option');
				}
				grunt.verbose.writeln('`svgoPlugins` option OK');

				// make sure unsharp is valid
				if (!validateUnsharp(options.unsharp)) {
					return grunt.fail.fatal('Invalid `unsharp` option');
				}
				grunt.verbose.writeln('`unsharp` option OK');

				// make sure widthAsDir is valid
				if (!validateWidthAsDir(options.widthAsDir)) {
					return grunt.fail.fatal('Invalid `widthAsDir` option');
				}
				grunt.verbose.writeln('`pngPreserveColormap` option OK');

				// make sure the widths are valid
				if (!validateWidths(options.widths)) {
					return grunt.fail.fatal('Invalid `widths` option');
				}
				grunt.verbose.writeln('`widths` option OK');

				// make sure there are images to resize
				if (task.files.length === 0) {
					return grunt.fail.fatal('No valid source files were found.');
				}
				grunt.verbose.writeln('Source files found');

				// loop through each input
				async.each(task.files, function(file, callback2) {
					// make sure we have a valid target and source
					validateTarget(file);
					validateSource(file);
					callback2();
				}, callback);
			}
138059
function ( obj, errorMsg ) {
            var result = Object.prototype.toString.call( obj ) === '[object Object]';
    
            if ( errorMsg && !result ) {
                warning( errorMsg );
                return false;
            } else {
                return result;
            }
        }
476607
function executeCallback(cb, arg) {
    var r = cb(arg)
    if(r !== undefined && !isLikeAFuture(r) )
        throw Error("Value returned from then or catch ("+r+") is *not* a Future. Callback: "+cb.toString())

    return r
}
1202101
function (cb) {
                var scope = cb.scope, callback;
                scope = scope ? scope : this;
                if (!cb.fn) {
                    callback = cb;
                } else {
                    callback = cb.fn;
                }

                if (typeof(callback) == 'string') {
                    callback = scope[callback];
                }
                return {
                    fn : callback,
                    scope : scope,
                    args : cb.args,
                    resIndex : cb.resIndex,
                    apply : cb.apply
                };
            }
738676
function detectCustomErrorMessage(key) {
            if (typeof properties[key] === 'object' && properties[key].errorMessage && properties[key].value) {
                return properties[key];
            }
            else  if (_.isArray(properties[key])) {
                return {
                    value: properties[key][0],
                    errorMessage: properties[key][1]
                };
            }
            else {
                return {
                    value: properties[key],
                    errorMessage: undefined
                };
            }
        }
161273
async function handleCallError (result) {
  const error = Buffer.from(result.returnValue).toString()
  if (isBase64(error.slice(3))) {
    const decodedError = Buffer.from(error.slice(3), 'base64').toString()
    throw Object.assign(Error(`Invocation failed: ${error}. Decoded: ${decodedError}`), R.merge(result, { error, decodedError }))
  }

  const decodedError = await this.contractDecodeData('string', error)
  throw Object.assign(Error(`Invocation failed: ${error}. Decoded: ${decodedError}`), R.merge(result, { error, decodedError }))
}
490054
function(error) {
		var that = this,
			param = this.chainParameter,
			stopPointer = {},
			utils = {
				stop: null,
				url: this.scraper.url,
				scraper: this,
				params: param,
				lastReturn: undefined
			},
			keep = true;
		this.chainParameter = null;

		if (error) {
			this.errorCallback(error, utils);
			this.doneCallback(utils);
			return;
		}

		async.eachSeries(this.promises, function dispatcher(fn, callback) {
			var done = function(err, lastReturn) {
				utils.lastReturn = lastReturn;
				if (err === stopPointer) {
					keep = false;
					callback(err);
				} else if (err) {
					callback(err);
				} else if (keep) {
					callback();
				}
			};
			utils.stop = function() {
				done(stopPointer, null);
			};

			try {
				fn.call(that, done, utils);
			} catch (err) {
				done(err, null);
			}
		}, function(err) {
			utils.stop = null;
			if (err && err !== stopPointer) {
				that.errorCallback(err, utils);
			}
			that.doneCallback(utils.lastReturn, utils);
			that.scraper.close();
		});
	}
113318
function(msg, code, errorStr, cb1) {
                return function(error, data) {
                    if (error) {
                        error = json_rpc.newSysError(msg, code, errorStr,
                                                     error);
                    }
                    cb1(error, data);
                };
            }
1201888
def _wrap_callback_errors(callback, message):
    
    try:
        callback(message)
    except Exception:
        # Note: the likelihood of this failing is extremely low. This just adds
        # a message to a queue, so if this doesn't work the world is in an
        # unrecoverable state and this thread should just bail.
        _LOGGER.exception(
            "Top-level exception occurred in callback while processing a " "message"
        )
        message.nack()
473389
function (id, options, cb) {
    if (arguments.length !== 3) {
      cb = options;
      options = {};
    }
    var self = this;
    var model = this.get(id);
    if (model){
      return cb(null, model);
    }
    function done() {
      var model = self.get(id);
      if (model) {
        if (cb){
          cb(null, model);
        }
      } else {
        cb(new Error('not found'));
      }
    }
    if (options.all) {
      this.fetch({
        callback: done
      });
    } else {
      this.fetchById(id, cb);
    }
  }
65233
function(callback, ctx){
      var k = 0;

      // 1. Let O be the result of calling ToObject passing the |this| value as the argument.
      var O = Object(this);

      var len = O.length >>> 0; 

      if ( typeof callback !== "function" ) {
        throw new TypeError( callback + " is not a function" );
      }

      // 7. Repeat, while k < len
      while( k < len ) {

        var kValue;

        if ( k in O ) {

          kValue = O[ k ];

          callback.call( ctx, kValue, k, O );
        }
        k++;
      }
    }
412600
function(err, stdout, stderr) {
    if(err) return callback(err);
    // Get the transformed source
    var source = stdout;
    // Compile the function
    eval(source)
    // Return the validation function
    callback(null, {
      validate: func
    });
  }
430906
function (cb) {
            if (cb) {
                if (isPromise(cb)) {
                    cb = cb.errback;
                }
                if (this.__fired && this.__error) {
                    this.__callNextTick(cb, this.__error);
                } else {
                    this.__errorCbs.push(cb);
                }
            }
            return this;
        }
208777
def callback(event, buffer = nil, start = nil, the_end = nil)
      return if !start.nil? && start == the_end
      if @callbacks.has_key? event
        @callbacks[event].call(buffer, start, the_end)
      end
    end