FUNCTION: onStats( error, stat )
Callback invoked upon collecting CPU and memory data for the current process.

@private
@param {Object} error
@param {Object} stat - process data
483392
function onStats( error, stat ) {
		if ( error ) {
			return clbk( error );
		}
		m.mem.memUsed = stat.memory / 1000; // KB
		m.mem.utilization = stat.memory / os.totalmem();
		m.cpu = {
			'utilization': stat.cpu / 100
		};
		clbk( null, m );
	}
838606
function onError (err) {
  console.error(chalk.red('✗ error:'), chalk.red(err.message))
  notifier.notify({
    title: 'Build failed:',
    message: err.message
  })
  this.emit('end')

  // When running without watch, process.exit(1) on error
  if (!watchifyEnabled) {
    process.exit(1)
  }
}
815677
function stat(path, callback) {
        appshell.fs.stat(path, function (err, stats) {
            if (err) {
                callback(_mapError(err));
            } else {
                var options = {
                    isFile: stats.isFile(),
                    mtime: stats.mtime,
                    size: stats.size,
                    realPath: stats.realPath,
                    hash: stats.mtime.getTime()
                };

                var fsStats = new FileSystemStats(options);

                callback(null, fsStats);
            }
        });
    }
994058
function onResError (ctx, err) {
  // nothing we can do here other
  // than delegate to the app-level
  // handler and log.
  if (ctx.headerSent || ctx._finished != null) {
    err.headerSent = ctx.headerSent
    err.context = ctx.toJSON()
    return err
  }

  // unset headers
  if (isFn(ctx.res.getHeaderNames)) {
    for (let name of ctx.res.getHeaderNames()) {
      if (!ON_ERROR_HEADER_REG.test(name)) ctx.res.removeHeader(name)
    }
  } else { // Node < 7.7
    let _headers = ctx.res._headers
    if (_headers) {
      // retain headers on error
      for (let name of Object.keys(_headers)) {
        if (!ON_ERROR_HEADER_REG.test(name)) delete _headers[name]
      }
    }
  }
  // support ENOENT to 404, default to 500
  if (err.code === 'ENOENT') ctx.status = 404
  else if (typeof err.status !== 'number' || !statuses[err.status]) ctx.status = 500
  else ctx.status = err.status

  ctx.set('x-content-type-options', 'nosniff')
  // support JSON error object: { error: 'BadRequest', message: 'Some bad request' }
  ctx.body = !isError(err) ? err : {
    error: err.error || err.name,
    message: err.expose ? err.message : statuses[ctx.status]
  }
  respond.call(ctx)
  return err
}
24803
function handleError(call, error) {
  var statusMetadata = new Metadata();
  var status = {
    code: constants.status.UNKNOWN,
    details: 'Unknown Error'
  };
  if (error.hasOwnProperty('message')) {
    status.details = error.message;
  }
  if (error.hasOwnProperty('code') && Number.isInteger(error.code)) {
    status.code = error.code;
    if (error.hasOwnProperty('details')) {
      status.details = error.details;
    }
  }
  if (error.hasOwnProperty('metadata')) {
    statusMetadata = error.metadata;
  }
  status.metadata = statusMetadata._getCoreRepresentation();
  var error_batch = {};
  if (!call.metadataSent) {
    error_batch[grpc.opType.SEND_INITIAL_METADATA] =
        (new Metadata())._getCoreRepresentation();
  }
  error_batch[grpc.opType.SEND_STATUS_FROM_SERVER] = status;
  call.startBatch(error_batch, function(){});
}
1202531
function getErrorStatusCode (err) {
  // check err.status
  if (typeof err.status === 'number' && err.status >= 400 && err.status < 600) {
    return err.status
  }

  // check err.statusCode
  if (typeof err.statusCode === 'number' && err.statusCode >= 400 && err.statusCode < 600) {
    return err.statusCode
  }

  return undefined
}
905529
function onRead( error, data ) {
		if ( error ) {
			return done( error );
		}
		data = parse( data, opts.reviver );
		if ( data instanceof Error ) {
			return done( data );
		}
		done( null, data );
	}
640008
function (error, response) {
        if (!_.isNull(error)) {
            error = _.createError(error);
        } else if (!_.isNull(response) && (response.status >= 400 || response.status === 0)) {
            error = _.createError(null, response);
            response = null;
        }
        callback(error, response);
    }
1122032
function onData(data) {

		data = data.toString("ascii");
		bufferedData += data;

		if (debug) console.log("Server: " + util.inspect(data));

		if (checkResp === true) {

			if (bufferedData.substr(0, 3) === "+OK") {

				checkResp = false;
				response = true;

			} else if (bufferedData.substr(0, 4) === "-ERR") {

				checkResp = false;
				response = false;

			// The following is only used for SASL
			} else if (multiline === false) {

				checkResp = false;
				response = true;

			}
		}

		if (checkResp === false) {

			if (multiline === true && (response === false || bufferedData.substr(bufferedData.length-5) === "\r\n.\r\n")) {

				// Make a copy to avoid race conditions
				var responseCopy = response;
				var bufferedDataCopy = bufferedData;

				response = null;
				checkResp = true;
				multiline = false;
				bufferedData = "";

				callback(responseCopy, bufferedDataCopy);

			} else if (multiline === false) {

				// Make a copy to avoid race conditions
				var responseCopy = response;
				var bufferedDataCopy = bufferedData;

				response = null;
				checkResp = true;
				multiline = false;
				bufferedData = "";

				callback(responseCopy, bufferedDataCopy);

			}
		} 
	}
1344891
function errHandler(err, req, res, next) {
  console.log(addTimestamp("Internal error: " + util.inspect(err)));
  console.error(addTimestamp("Internal error: " + util.inspect(err)));
  if (err && err.stack) {
    console.error(err.stack);
  }

  var errorMessage = {
    msg: 'Internal error: ' + util.inspect(err),
    error: util.inspect(err)
  };
  if (res) {
    res.statusCode = 500;
    res.end(JSON.stringify(errorMessage));
  }

  return errorMessage;
}
1092476
async def on_raw_error(self, message):
        
        error = protocol.ServerError(' '.join(message.params))
        await self.on_data_error(error)
505598
function done(error) {
    if (error) {
      errors.push(error);
    }
    if (--initializing <= 0) {
      if (errors && errors.length) {
        var errorResult = new Error('Errors occurred during initialization.');
        errorResult.initializationErrors = errors;
        callback(errorResult);
      } else {
        processPostInitializeQueue(postInitializeQueue, callback);
      }
    }
  }
315134
protected void noteError(ServerStats stats, ClientRequest request, Throwable e, long responseTime) {
    	if (stats == null) {
    		return;
    	}
        try {
            recordStats(stats, responseTime);
            RetryHandler errorHandler = getRetryHandler();
            if (errorHandler != null && e != null) {
                if (errorHandler.isCircuitTrippingException(e)) {
                    stats.incrementSuccessiveConnectionFailureCount();                    
                    stats.addToFailureCount();
                } else {
                    stats.clearSuccessiveConnectionFailureCount();
                }
            }
        } catch (Exception ex) {
            logger.error("Error noting stats for client {}", clientName, ex);
        }            
    }
742444
function registryError(err, res, callback) {
    var body = '';
    res.on('data', function onResChunk(chunk) {
        body += chunk;
    });
    res.on('end', function onResEnd() {
        // Parse errors in the response body.
        var message = _getRegistryErrMessage(body);
        if (message) {
            err.message = message;
        }
        callback(err);
    });
}
45501
function processErrorAndData (error, data) {
    if (_cb.beforeReturnErrorAndData) { _cb.beforeReturnErrorAndData(error, data); }
    if (_cb.returnErrorAndData) { _cb.returnErrorAndData(error, data, response); }
    if (_cb.afterReturnErrorAndData) { _cb.afterReturnErrorAndData(error, data); }
  }
1362590
function checkLoadStatus(onload) {
            if (loadCount === resourceCount) {
                // wait 1/2s and execute callback (cheap workaround to ensure everything is loaded)
                if (onload || api.onload) {
                    // make sure we clear the timer
                    clearTimeout(timerId);
                    // trigger the onload callback
                    // we call either the supplied callback (which takes precedence) or the global one
                    var callback = onload || api.onload;
                    setTimeout(function () {
                        callback();
                        me.event.publish(me.event.LOADER_COMPLETE);
                    }, 300);
                }
                else {
                    throw new Error("no load callback defined");
                }
            }
            else {
                timerId = setTimeout(function() {
                    checkLoadStatus(onload);
                }, 100);
            }
        }
32061
function (error) {
        if (!this.started) {
            return;
        }

        var errorHandlers = this.errorHandlers,
            length = errorHandlers.length,
            errorHandler,
            errorHandled = false,
            errorString,
            i;

        //Exit handling
        if (error instanceof SystemExit) {
            this._exit(error.code);
            return;
        }

        try {
            for (i = 0; i < length; i += 1) {
                errorHandler = errorHandlers[i];
                errorHandled = !!errorHandler(error);

                if (errorHandled) {
                    return;
                }
            }
        } catch (e) {
            this._printError(e);
            this._exit(1);
        }

        //Default error handling
        errorString = '' + (error.stack || error);
        this._printError(errorString);
        this._exit(1);
    }