Format orchestrator errors
550911
function formatError(e) {
    if (!e.err) {
        return e.message
    }
    // PluginError
    if (typeof e.err.showStack === 'boolean') {
        return e.err.toString()
    }
    // Normal error
    if (e.err.stack) {
        return e.err.stack
    }
    // Unknown (string, number, etc.)
    return new Error(String(e.err)).stack
}
1059032
function formatError(e) {
  if (!e.err) return e.message;
  if (e.err.message) return e.err.message;
  return JSON.stringify(e.err);
}
1164533
function formatError(err, options) {
    options = options || {};
    var name = err.name || err.constructor.name;
    var str = util.format('%s: %s\n', name, err.message);
    if (err.buffer && err.buffer.hexdump) {
        str += err.buffer.hexdump({
            colored: options.color,
            boldStart: false,
            highlight: options.color ? errorHighlighter(err, options) : null
        });
    } else if (Buffer.isBuffer(err.buffer)) {
        if (options.color) {
            str += formatBufferColored(err, options);
        } else {
            str += formatBufferUncolored(err, options);
        }
    }
    return str;
}
785948
def format_config_for_editing(data):
    """"""
    return yaml.safe_dump(data, default_flow_style=False, encoding=None, allow_unicode=True)
127497
def _raise_missing_antenna_errors(ant_uvw, max_err):
    

    # Find antenna uvw coordinates where any UVW component was nan
    # nan + real == nan
    problems = np.nonzero(np.add.reduce(np.isnan(ant_uvw), axis=2))
    problem_str = []

    for c, a in zip(*problems):
        problem_str.append("[chunk %d antenna %d]" % (c, a))

        # Exit early
        if len(problem_str) >= max_err:
            break

    # Return early if nothing was wrong
    if len(problem_str) == 0:
        return

    # Add a preamble and raise exception
    problem_str = ["Antenna were missing"] + problem_str
    raise AntennaMissingError('\n'.join(problem_str))
20153
def _format_playlist_line(self, lineNum, pad, station):
        
        line = "{0}. {1}".format(str(lineNum + self.startPos + 1).rjust(pad), station[0])
        f_data = ' [{0}, {1}]'.format(station[2], station[1])
        if version_info < (3, 0):
            if len(line.decode('utf-8', 'replace')) + len(f_data.decode('utf-8', 'replace')) > self.bodyMaxX -2:
                """ this is too long, try to shorten it
                    by removing file size """
                f_data = ' [{0}]'.format(station[1])
            if len(line.decode('utf-8', 'replace')) + len(f_data.decode('utf-8', 'replace')) > self.bodyMaxX - 2:
                """ still too long. start removing chars """
                while len(line.decode('utf-8', 'replace')) + len(f_data.decode('utf-8', 'replace')) > self.bodyMaxX - 3:
                    f_data = f_data[:-1]
                f_data += ']'
            """ if too short, pad f_data to the right """
            if len(line.decode('utf-8', 'replace')) + len(f_data.decode('utf-8', 'replace')) < self.maxX - 2:
                while len(line.decode('utf-8', 'replace')) + len(f_data.decode('utf-8', 'replace')) < self.maxX - 2:
                    line += ' '
        else:
            if len(line) + len(f_data) > self.bodyMaxX -2:
                """ this is too long, try to shorten it
                    by removing file size """
                f_data = ' [{0}]'.format(station[1])
            if len(line) + len(f_data) > self.bodyMaxX - 2:
                """ still too long. start removing chars """
                while len(line) + len(f_data) > self.bodyMaxX - 3:
                    f_data = f_data[:-1]
                f_data += ']'
            """ if too short, pad f_data to the right """
            if len(line) + len(f_data) < self.maxX - 2:
                while len(line) + len(f_data) < self.maxX - 2:
                    line += ' '
        line += f_data
        return line
601588
def _surpress_formatting_errors(fn):
    
    @wraps(fn)
    def inner(*args, **kwargs):
        try:
            return fn(*args, **kwargs)
        except ValueError:
            return ""
    return inner
885382
function logEvents(gulp) {
  // total hack due to fucked up error management in orchestrator
  gulp.on('err', function(){});

  gulp.on('task_start', function(e) {
    gutil.log('Starting', "'" + chalk.cyan(e.task) + "'...");
  });

  gulp.on('task_stop', function(e) {
    var time = prettyTime(e.hrDuration);
    gutil.log('Finished', "'" + chalk.cyan(e.task) + "'", 'after', chalk.magenta(time));
  });

  gulp.on('task_err', function(e) {
    var msg = formatError(e);
    var time = prettyTime(e.hrDuration);
    gutil.log("'" + chalk.cyan(e.task) + "'", 'errored after', chalk.magenta(time), chalk.red(msg));
  });

  gulp.on('task_not_found', function(err) {
    gutil.log(chalk.red("Task '" + err.task + "' was not defined in your gulpfile but you tried to run it."));
    gutil.log('Please check the documentation for proper gulpfile formatting.');
    process.exit(1);
  });
}
1172958
function formatError(e) {
  if (!e.error) {
    return e.message;
  }

  // Don't show stacktrace on informational errors
  if (e.error instanceof Information) {
    return e.error.message;
  }

  // PluginError
  if (typeof e.error.showStack === "boolean") {
    return e.error.toString();
  }
  // Normal error
  if (e.error.stack) {
    return e.error.stack;
  }
  // Unknown (string, number, etc.)
  return new Error(String(e.error)).stack;
}
717664
def _flatten_marshmallow_errors(errors):
    """"""
    res = []
    for field, error in errors.items():
        if isinstance(error, list):
            res.append(
                dict(field=field, message=' '.join([str(x) for x in error])))
        elif isinstance(error, dict):
            res.extend(_flatten_marshmallow_errors(error))
    return res
981882
function(){
            if(errors.length) return cb(errors);
            var transform = opts.transform || function(_result, _cb){
              _cb(null, _result);
            };
            transform(result, function(err, _result){
              if(err){
                errors.push(formatError(err, key));
                cb(errors);
              }else{
                cb(null, _result);
              }
            });
          }
1085995
def format_errors(errors):
        

        def _get_message(node):
            """
            Get the message to display in the error output.
            """
            messages = set()

            try:
                messages.update([node['message']])
            except KeyError:
                pass

            for check_group in ['any', 'all', 'none']:
                try:
                    for check in node[check_group]:
                        messages.update([check.get('message')])
                except KeyError:
                    pass

            messages = messages.difference([''])
            return '; '.join(messages)

        lines = []
        for error_type in errors:
            lines.append(u"Severity: {}".format(error_type.get("impact")))
            lines.append(u"Rule ID: {}".format(error_type.get("id")))
            lines.append(u"Help URL: {}\n".format(error_type.get('helpUrl')))

            for node in error_type['nodes']:
                msg = u"Message: {}".format(_get_message(node))
                html = u"Html: {}".format(node.get('html').encode('utf-8'))
                target = u"Target: {}".format(node.get('target'))
                fill_opts = {
                    'width': 100,
                    'initial_indent': '\t',
                    'subsequent_indent': '\t\t',
                }
                lines.append(fill(msg, **fill_opts))
                lines.append(fill(html, **fill_opts))
                lines.append(fill(target, **fill_opts))
                lines.append('\n')

        return '\n'.join(lines)
395362
function AddonFormatError(msg) {
  Error.call(this);

  Error.captureStackTrace(this, AddonFormatError);

  /** @override */
  this.name = AddonFormatError.name;

  /** @override */
  this.message = msg;
}
494097
function onOutError(err) {
    errNodecat = combineErrors(errNodecat, err);
    errStream.write(`nodecat: ${err}\n`);
    if (inCleanup) {
      inCleanup();
    }
    allDone();
  }
486469
def formatException(type, value, tb):
    

    # Absolute paths to site-packages
    packages = tuple(join(abspath(p), "") for p in sys.path[1:])

    # Highlight lines not referring to files in site-packages
    lines = []
    for line in format_exception(type, value, tb):
        matches = re.search(r"^  File \"([^\"]+)\", line \d+, in .+", line)
        if matches and matches.group(1).startswith(packages):
            lines += line
        else:
            matches = re.search(r"^(\s*)(.*?)(\s*)$", line, re.DOTALL)
            lines.append(matches.group(1) + colored(matches.group(2), "yellow") + matches.group(3))
    return "".join(lines).rstrip()
532349
def setValidityErrorHandler(self, err_func, warn_func, arg=None):
        
        libxml2mod.xmlSchemaSetValidErrors(self._o, err_func, warn_func, arg)
312016
def format_error(self, field_name, message, index=None):
        
        pointer = ['/data']

        if index is not None:
            pointer.append(str(index))

        relationship = isinstance(
            self.declared_fields.get(field_name), BaseRelationship,
        )
        if relationship:
            pointer.append('relationships')
        elif field_name != 'id':
            # JSONAPI identifier is a special field that exists above the attribute object.
            pointer.append('attributes')

        pointer.append(self.inflect(field_name))

        if relationship:
            pointer.append('data')

        return {
            'detail': message,
            'source': {
                'pointer': '/'.join(pointer),
            },
        }