How to use errno - 10 common examples

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 rexxars / openvpn-config-splitter / lib / error.js View on Github external
module.exports = function (err) {
  var str = 'Error: '

  // If it's a libuv error then get the description from errno
  if (errno.errno[err.errno]) {
    str += errno.errno[err.errno].description
  } else {
    str += err.message
  }

  // If it's an fs error then it'll have a 'path' property
  if (err.path) {
    str += ' [' + err.path + ']'
  }

  console.log(str)
  process.exit(err.code || 1)
}
github rexxars / openvpn-config-splitter / lib / error.js View on Github external
module.exports = function (err) {
  var str = 'Error: '

  // If it's a libuv error then get the description from errno
  if (errno.errno[err.errno]) {
    str += errno.errno[err.errno].description
  } else {
    str += err.message
  }

  // If it's an fs error then it'll have a 'path' property
  if (err.path) {
    str += ' [' + err.path + ']'
  }

  console.log(str)
  process.exit(err.code || 1)
}
github MuYunyun / reactSPA / node_modules / memory-fs / lib / MemoryFileSystem.js View on Github external
function pathToArray(path) {
	path = normalize(path);
	var nix = /^\//.test(path);
	if(!nix) {
		if(!/^[A-Za-z]:/.test(path)) {
			throw new MemoryFileSystemError(errors.code.EINVAL, path);
		}
		path = path.replace(/[\\\/]+/g, "\\"); // multi slashs
		path = path.split(/[\\\/]/);
		path[0] = path[0].toUpperCase();
	} else {
		path = path.replace(/\/+/g, "/"); // multi slashs
		path = path.substr(1).split("/");
	}
	if(!path[path.length-1]) path.pop();
	return path;
}
github eschirtz / Computer-Science-Series / node_modules / memory-fs / lib / MemoryFileSystem.js View on Github external
function pathToArray(path) {
	path = normalize(path);
	var nix = /^\//.test(path);
	if(!nix) {
		if(!/^[A-Za-z]:/.test(path)) {
			throw new MemoryFileSystemError(errors.code.EINVAL, path);
		}
		path = path.replace(/[\\\/]+/g, "\\"); // multi slashs
		path = path.split(/[\\\/]/);
		path[0] = path[0].toUpperCase();
	} else {
		path = path.replace(/\/+/g, "/"); // multi slashs
		path = path.substr(1).split("/");
	}
	if(!path[path.length-1]) path.pop();
	return path;
}
github myFace-KYC / Identity_Verification / node_modules / memory-fs / lib / MemoryFileSystem.js View on Github external
function pathToArray(path) {
	path = normalize(path);
	var nix = /^\//.test(path);
	if(!nix) {
		if(!/^[A-Za-z]:/.test(path)) {
			throw new MemoryFileSystemError(errors.code.EINVAL, path);
		}
		path = path.replace(/[\\\/]+/g, "\\"); // multi slashs
		path = path.split(/[\\\/]/);
		path[0] = path[0].toUpperCase();
	} else {
		path = path.replace(/\/+/g, "/"); // multi slashs
		path = path.substr(1).split("/");
	}
	if(!path[path.length-1]) path.pop();
	return path;
}
github oslabs-beta / ReactRTC / node_modules / webpack / node_modules / enhanced-resolve / node_modules / memory-fs / lib / MemoryFileSystem.js View on Github external
function pathToArray(path) {
	path = normalize(path);
	const nix = /^\//.test(path);
	if(!nix) {
		if(!/^[A-Za-z]:/.test(path)) {
			throw new MemoryFileSystemError(errors.code.EINVAL, path);
		}
		path = path.replace(/[\\\/]+/g, "\\"); // multi slashs
		path = path.split(/[\\\/]/);
		path[0] = path[0].toUpperCase();
	} else {
		path = path.replace(/\/+/g, "/"); // multi slashs
		path = path.substr(1).split("/");
	}
	if(!path[path.length-1]) path.pop();
	return path;
}
github miukimiu / react-kawaii / node_modules / memory-fs / lib / MemoryFileSystem.js View on Github external
function pathToArray(path) {
	path = normalize(path);
	var nix = /^\//.test(path);
	if(!nix) {
		if(!/^[A-Za-z]:/.test(path)) {
			throw new MemoryFileSystemError(errors.code.EINVAL, path);
		}
		path = path.replace(/[\\\/]+/g, "\\"); // multi slashs
		path = path.split(/[\\\/]/);
		path[0] = path[0].toUpperCase();
	} else {
		path = path.replace(/\/+/g, "/"); // multi slashs
		path = path.substr(1).split("/");
	}
	if(!path[path.length-1]) path.pop();
	return path;
}
github saghul / sjs / modules / process.js View on Github external
os._exit(127);
    } else {
        // parent
        //

        // wait until child has started
        os.close(errorPipe[1]);
        var r = os.read(errorPipe[0]);
        if (r.length === 0) {
            // child started succesfully
            r = 0;
        } else {
            var p = os.waitpid(pid, 0);
            assert.equal(p.pid, pid);
            var errorno = Number.parseInt(new TextDecoder().decode(r));
            r = new Error('Faild to spawn child: [errno ' + errorno + '] ' + errno.strerror(errorno));
            r.errno = errorno;
        }

        // close fds
        var fds = [devNull, errorPipe[0], stdinPipe[0], stdoutPipe[1], stderrPipe[1]];
        fds.forEach(function(fd) {
            if (fd > os.STDERR_FILENO) {
                silentClose(fd);
            }
        });

        // throw error, if there was one
        if (r instanceof Error) {
            throw r;
        }
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() {

errno

libuv errno details exposed

MIT
Latest version published 3 years ago

Package Health Score

74 / 100
Full package analysis