How to use the error-ex function in error-ex

To help you get started, we’ve selected a few error-ex 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 buildo / smooth-release / src / utils.js View on Github external
// EXEC INTERFACE
export const exec = (command, settings) => {
  return new Promise((resolve, reject) => {
    _exec(command, settings, (error, stdout) => {
      if (error) {
        reject(error);
      } else {
        resolve(stdout);
      }
    });
  });
};


// CUSTOM ERROR
export const SmoothReleaseError = errorEx('SmoothReleaseError');

export const onError = e => {
  status.stop();
  if (e instanceof SmoothReleaseError) {
    error(`\nError: ${e.message}\n`);
  } else {
    error('\n', e.stack);
  }
  process.exit(1);
};


// UTILS
export const getCurrentBranch = () => execSync('git rev-parse --abbrev-ref HEAD', { encoding: 'utf8' }).trim();

export const isVersionTag = tag => (

error-ex

Easy error subclassing and stack customization

MIT
Latest version published 6 years ago

Package Health Score

71 / 100
Full package analysis

Popular error-ex functions