How to use the errno.create function in errno

To help you get started, we’ve selected a few errno examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github facebook / metro / packages / metro-bundler / src / worker-farm / lib / farm.js View on Github external
const DEFAULT_OPTIONS = {
  maxCallsPerWorker: Infinity,
  maxConcurrentWorkers: require('os').cpus().length,
  maxConcurrentCallsPerWorker: 10,
  maxConcurrentCalls: Infinity,
  maxCallTime: Infinity, // exceed this and the whole worker is terminated
  maxRetries: Infinity,
  forcedKillTime: 100,
  autoStart: false,
};

const extend = require('xtend'),
  fork = require('./fork'),
  TimeoutError = require('errno').create('TimeoutError'),
  ProcessTerminatedError = require('errno').create('ProcessTerminatedError'),
  MaxConcurrentCallsError = require('errno').create('MaxConcurrentCallsError');

const mergeStream = require('merge-stream');

function Farm(options: {+execArgv: Array}, path: string) {
  this.options = extend(DEFAULT_OPTIONS, options);
  this.path = path;
  this.activeCalls = 0;
  this.stdout = mergeStream();
  this.stderr = mergeStream();
}

// make a handle to pass back in the form of an external API
Farm.prototype.mkhandle = function(method) {
  return function() {
    var args = Array.prototype.slice.call(arguments);
    if (this.activeCalls >= this.options.maxConcurrentCalls) {
github facebook / metro / packages / metro-bundler / src / worker-farm / lib / farm.js View on Github external
/* eslint-disable */
const DEFAULT_OPTIONS = {
  maxCallsPerWorker: Infinity,
  maxConcurrentWorkers: require('os').cpus().length,
  maxConcurrentCallsPerWorker: 10,
  maxConcurrentCalls: Infinity,
  maxCallTime: Infinity, // exceed this and the whole worker is terminated
  maxRetries: Infinity,
  forcedKillTime: 100,
  autoStart: false,
};

const extend = require('xtend'),
  fork = require('./fork'),
  TimeoutError = require('errno').create('TimeoutError'),
  ProcessTerminatedError = require('errno').create('ProcessTerminatedError'),
  MaxConcurrentCallsError = require('errno').create('MaxConcurrentCallsError');

const mergeStream = require('merge-stream');

function Farm(options: {+execArgv: Array}, path: string) {
  this.options = extend(DEFAULT_OPTIONS, options);
  this.path = path;
  this.activeCalls = 0;
  this.stdout = mergeStream();
  this.stderr = mergeStream();
}

// make a handle to pass back in the form of an external API
Farm.prototype.mkhandle = function(method) {
  return function() {
github rvagg / node-worker-farm / lib / farm.js View on Github external
const DEFAULT_OPTIONS = {
          workerOptions               : {}
        , maxCallsPerWorker           : Infinity
        , maxConcurrentWorkers        : (require('os').cpus() || { length: 1 }).length
        , maxConcurrentCallsPerWorker : 10
        , maxConcurrentCalls          : Infinity
        , maxCallTime                 : Infinity // exceed this and the whole worker is terminated
        , maxRetries                  : Infinity
        , forcedKillTime              : 100
        , autoStart                   : false
        , onChild                     : function() {}
      }

const fork                    = require('./fork')
    , TimeoutError            = require('errno').create('TimeoutError')
    , ProcessTerminatedError  = require('errno').create('ProcessTerminatedError')
    , MaxConcurrentCallsError = require('errno').create('MaxConcurrentCallsError')


function Farm (options, path) {
  this.options     = Object.assign({}, DEFAULT_OPTIONS, options)
  this.path        = path
  this.activeCalls = 0
}


// make a handle to pass back in the form of an external API
Farm.prototype.mkhandle = function (method) {
  return function () {
    let args = Array.prototype.slice.call(arguments)
    if (this.activeCalls + this.callQueue.length >= this.options.maxConcurrentCalls) {
      let err = new MaxConcurrentCallsError('Too many concurrent calls (active: ' + this.activeCalls + ', queued: ' + this.callQueue.length + ')')
github ifgyong / demo / React-native / Helloword / node_modules / worker-farm / lib / farm.js View on Github external
'use strict'

const DEFAULT_OPTIONS = {
    workerOptions: {}
    , maxCallsPerWorker: Infinity
    , maxConcurrentWorkers: (require('os').cpus() || {length: 1}).length
    , maxConcurrentCallsPerWorker: 10
    , maxConcurrentCalls: Infinity
    , maxCallTime: Infinity // exceed this and the whole worker is terminated
    , maxRetries: Infinity
    , forcedKillTime: 100
    , autoStart: false
}

const fork = require('./fork')
    , TimeoutError = require('errno').create('TimeoutError')
    , ProcessTerminatedError = require('errno').create('ProcessTerminatedError')
    , MaxConcurrentCallsError = require('errno').create('MaxConcurrentCallsError')


function Farm(options, path) {
    this.options = Object.assign({}, DEFAULT_OPTIONS, options)
    this.path = path
    this.activeCalls = 0
}


// make a handle to pass back in the form of an external API
Farm.prototype.mkhandle = function (method) {
    return function () {
        let args = Array.prototype.slice.call(arguments)
        if (this.activeCalls >= this.options.maxConcurrentCalls) {
github rvagg / node-worker-farm / lib / farm.js View on Github external
const DEFAULT_OPTIONS = {
          workerOptions               : {}
        , maxCallsPerWorker           : Infinity
        , maxConcurrentWorkers        : (require('os').cpus() || { length: 1 }).length
        , maxConcurrentCallsPerWorker : 10
        , maxConcurrentCalls          : Infinity
        , maxCallTime                 : Infinity // exceed this and the whole worker is terminated
        , maxRetries                  : Infinity
        , forcedKillTime              : 100
        , autoStart                   : false
        , onChild                     : function() {}
      }

const fork                    = require('./fork')
    , TimeoutError            = require('errno').create('TimeoutError')
    , ProcessTerminatedError  = require('errno').create('ProcessTerminatedError')
    , MaxConcurrentCallsError = require('errno').create('MaxConcurrentCallsError')


function Farm (options, path) {
  this.options     = Object.assign({}, DEFAULT_OPTIONS, options)
  this.path        = path
  this.activeCalls = 0
}


// make a handle to pass back in the form of an external API
Farm.prototype.mkhandle = function (method) {
  return function () {
    let args = Array.prototype.slice.call(arguments)
    if (this.activeCalls + this.callQueue.length >= this.options.maxConcurrentCalls) {
github ifgyong / demo / React-native / Helloword / node_modules / worker-farm / lib / farm.js View on Github external
const DEFAULT_OPTIONS = {
    workerOptions: {}
    , maxCallsPerWorker: Infinity
    , maxConcurrentWorkers: (require('os').cpus() || {length: 1}).length
    , maxConcurrentCallsPerWorker: 10
    , maxConcurrentCalls: Infinity
    , maxCallTime: Infinity // exceed this and the whole worker is terminated
    , maxRetries: Infinity
    , forcedKillTime: 100
    , autoStart: false
}

const fork = require('./fork')
    , TimeoutError = require('errno').create('TimeoutError')
    , ProcessTerminatedError = require('errno').create('ProcessTerminatedError')
    , MaxConcurrentCallsError = require('errno').create('MaxConcurrentCallsError')


function Farm(options, path) {
    this.options = Object.assign({}, DEFAULT_OPTIONS, options)
    this.path = path
    this.activeCalls = 0
}


// make a handle to pass back in the form of an external API
Farm.prototype.mkhandle = function (method) {
    return function () {
        let args = Array.prototype.slice.call(arguments)
        if (this.activeCalls >= this.options.maxConcurrentCalls) {
            let err = new MaxConcurrentCallsError('Too many concurrent calls (' + this.activeCalls + ')')
github ifgyong / demo / React-native / Helloword / node_modules / metro-bundler / src / worker-farm / lib / farm.js View on Github external
const DEFAULT_OPTIONS = {
    maxCallsPerWorker: Infinity,
    maxConcurrentWorkers: require('os').cpus().length,
    maxConcurrentCallsPerWorker: 10,
    maxConcurrentCalls: Infinity,
    maxCallTime: Infinity, // exceed this and the whole worker is terminated
    maxRetries: Infinity,
    forcedKillTime: 100,
    autoStart: false
};


const extend = require('xtend'),
    fork = require('./fork'),
    TimeoutError = require('errno').create('TimeoutError'),
    ProcessTerminatedError = require('errno').create('ProcessTerminatedError'),
    MaxConcurrentCallsError = require('errno').create('MaxConcurrentCallsError');

const mergeStream = require('merge-stream');

function Farm(options, path) {
    this.options = extend(DEFAULT_OPTIONS, options);
    this.path = path;
    this.activeCalls = 0;
    this.stdout = mergeStream();
    this.stderr = mergeStream();
}

// make a handle to pass back in the form of an external API
Farm.prototype.mkhandle = function (method) {
    return function () {
        var args = Array.prototype.slice.call(arguments);
github DigixGlobal / truffle-lightwallet-provider / node_modules / level-errors / errors.js View on Github external
/* Copyright (c) 2012-2017 LevelUP contributors
 * See list at 
 * MIT License
 * 
 */

var createError   = require('errno').create
  , LevelUPError  = createError('LevelUPError')
  , NotFoundError = createError('NotFoundError', LevelUPError)

NotFoundError.prototype.notFound = true
NotFoundError.prototype.status   = 404

module.exports = {
    LevelUPError        : LevelUPError
  , InitializationError : createError('InitializationError', LevelUPError)
  , OpenError           : createError('OpenError', LevelUPError)
  , ReadError           : createError('ReadError', LevelUPError)
  , WriteError          : createError('WriteError', LevelUPError)
  , NotFoundError       : NotFoundError
  , EncodingError       : createError('EncodingError', LevelUPError)
}
github DigixGlobal / truffle-lightwallet-provider / node_modules / level-errors / errors.js View on Github external
var createError   = require('errno').create
  , LevelUPError  = createError('LevelUPError')
  , NotFoundError = createError('NotFoundError', LevelUPError)

NotFoundError.prototype.notFound = true
NotFoundError.prototype.status   = 404

module.exports = {
    LevelUPError        : LevelUPError
  , InitializationError : createError('InitializationError', LevelUPError)
  , OpenError           : createError('OpenError', LevelUPError)
  , ReadError           : createError('ReadError', LevelUPError)
  , WriteError          : createError('WriteError', LevelUPError)
  , NotFoundError       : NotFoundError
  , EncodingError       : createError('EncodingError', LevelUPError)
}
github DigixGlobal / truffle-lightwallet-provider / node_modules / level-errors / errors.js View on Github external
* MIT License
 * 
 */

var createError   = require('errno').create
  , LevelUPError  = createError('LevelUPError')
  , NotFoundError = createError('NotFoundError', LevelUPError)

NotFoundError.prototype.notFound = true
NotFoundError.prototype.status   = 404

module.exports = {
    LevelUPError        : LevelUPError
  , InitializationError : createError('InitializationError', LevelUPError)
  , OpenError           : createError('OpenError', LevelUPError)
  , ReadError           : createError('ReadError', LevelUPError)
  , WriteError          : createError('WriteError', LevelUPError)
  , NotFoundError       : NotFoundError
  , EncodingError       : createError('EncodingError', LevelUPError)
}

errno

libuv errno details exposed

MIT
Latest version published 4 years ago

Package Health Score

74 / 100
Full package analysis