Runs {@code parser} with error recording suppressed.
165890
final boolean withErrorSuppressed(Parser<?> parser) {
    boolean oldValue = errorSuppressed;
    errorSuppressed = true;
    boolean ok = parser.apply(this);
    errorSuppressed = oldValue;
    return ok;
  }
680370
void logError(final String message) {
      if(logger != null) {
         try {
            StringBuilder buf = new StringBuilder(name);
            buf.append(":");
            buf.append(message);
            logger.error(buf.toString());            
         } catch(Throwable t) {
            //Ignore - logging should not kill anything
         }
      }
   }
686640
public static void error(String msg, Throwable t) {
        if (quietMode)
            return;

        System.err.println(ERR_PREFIX + msg);
        if (t != null) {
            t.printStackTrace();
        }
    }
428613
void reportError(Throwable throwable) {
    if (logger != null)
      logger.error("Timer reported error", throwable);
    status = "Thread blocked on error: " + throwable;
    error_skips = error_factor;
  }
876897
@FormatMethod
  private void reportError(@FormatString String message, Object... arguments) {
    errorReporter.reportError(scanner.getPosition(), message, arguments);
  }
298025
def p_error(p):
    

    if p is None:
        raise MOFParseError(msg='Unexpected end of file')

    msg = p.lexer.last_msg
    p.lexer.last_msg = None
    raise MOFParseError(parser_token=p, msg=msg)
1218449
public void javacError(String message, Throwable t) {
		messager.printMessage(Diagnostic.Kind.ERROR, message + (t == null ? "" : (": " + t)));
		if (t != null) t.printStackTrace();
	}
669752
function ParserError(message) {
    this.message = message;
    this.name = 'ParserError';

    try {
      throw new Error();
    } catch (e) {
      if (e.stack) {
        var split = e.stack.split('\n');
        split.shift();
        this.stack = split.join('\n');
      }
    }
  }
519082
private void checkErrorStream(Process process) throws Exception {
		// rrdtool should use platform encoding (unless you did something
		// very strange with your installation of rrdtool). So let's be
		// explicit and use the presumed correct encoding to read errors.
		try (
				InputStream is = process.getErrorStream();
				InputStreamReader isr = new InputStreamReader(is, Charset.defaultCharset());
				BufferedReader br = new BufferedReader(isr)
		) {
			StringBuilder sb = new StringBuilder();
			String line;
			while ((line = br.readLine()) != null) {
				sb.append(line);
			}
			if (sb.length() > 0) {
				throw new RuntimeException(sb.toString());
			}
		}
	}
970972
public void validateRange(final LmlParser parser) {
        if (min >= max || stepSize > max - min || value < min || value > max || stepSize <= 0f) {
            parser.throwError(
                    "Range widget not properly constructed. Min value has to be lower than max and step size cannot be higher than the difference between min and max values. Initial value cannot be lower than min or higher than max value. Step size cannot be zero or negative.");
        }
    }
281140
def run
      if result = analyze
        synthesize(result)
      else
        puts parser.failure
        exit ERRNO_PARSE_ERROR
      end
    end
869902
@SuppressWarnings("unchecked")
  public void run(RecordReader<K1, V1> input, OutputCollector<K2, V2> output,
                  Reporter reporter) throws IOException {
    Application<K1, V1, K2, V2> application = null;
    try {
      RecordReader<FloatWritable, NullWritable> fakeInput = 
        (!Submitter.getIsJavaRecordReader(job) && 
         !Submitter.getIsJavaMapper(job)) ? 
	  (RecordReader<FloatWritable, NullWritable>) input : null;
      application = new Application<K1, V1, K2, V2>(job, fakeInput, output, 
                                                    reporter,
          (Class<? extends K2>) job.getOutputKeyClass(), 
          (Class<? extends V2>) job.getOutputValueClass());
    } catch (InterruptedException ie) {
      throw new RuntimeException("interrupted", ie);
    }
    DownwardProtocol<K1, V1> downlink = application.getDownlink();
    boolean isJavaInput = Submitter.getIsJavaRecordReader(job);
    downlink.runMap(reporter.getInputSplit(), 
                    job.getNumReduceTasks(), isJavaInput);
    boolean skipping = job.getBoolean("mapred.skip.on", false);
    try {
      if (isJavaInput) {
        // allocate key & value instances that are re-used for all entries
        K1 key = input.createKey();
        V1 value = input.createValue();
        downlink.setInputTypes(key.getClass().getName(),
                               value.getClass().getName());
        
        while (input.next(key, value)) {
          // map pair to output
          downlink.mapItem(key, value);
          if(skipping) {
            //flush the streams on every record input if running in skip mode
            //so that we don't buffer other records surrounding a bad record.
            downlink.flush();
          }
        }
        downlink.endOfInput();
      }
      application.waitForFinish();
    } catch (Throwable t) {
      application.abort(t);
    } finally {
      application.cleanup();
    }
  }
305313
public void run() {
        logger.trace("BlockingConsumer " + this + " starting data processing");

        int length;
        char cs[] = new char[256];
        Reader reader = pair.getReader();

        while (!stopRequested && !foundEOF) {
            try {
                logger.trace("BlockingConsumer " + this + " reading from reader");
                length = reader.read(cs); // blocking
            } catch (IOException ioe) {
                // The reader most likely closed on us.
                logger.warn("Caught an exception while reading: " + ioe);
                logger.debug("Assuming EOF");
                foundEOF = true;
                break;
            }

            if (length == -1) { //EOF
                logger.debug("BlockingConsumer " + this + " detected EOF");
                logger.trace("Remaining buffer: " + buffer.toString());
                foundEOF = true;
                break;
            }

            // don't modify the buffer while processing is happening
            // written as while loop to prevent spurious interrupts
            logger.trace("BlockingConsumer " + this + " waiting for synchronized access before appending");
            synchronized(this) { // this could be just before notify, I think
                if (logger.isDebugEnabled()) {
                    logger.debug("BlockingConsumer " + this + " appending " + length + " characters to the buffer");

                    // TODO: this replace operation is done a few places, perhaps utility class?
                    String print = new String(cs, 0, length);
                    print = print.replaceAll("\n", "\\\\n");
                    print = print.replaceAll("\r", "\\\\r");
                    logger.debug("Adding to buffer: " + print);

                    StringBuffer sb = new StringBuffer();
                    for (int i = 0; i < length; i++)
                        sb.append("," + ((int) cs[i]) );
                    logger.trace("Codes: " + sb.toString());
                }
                buffer.append(cs, 0, length); // thread safe

                /**
                 * TODO Trim down buffer.  This current method won't work if a resume comes in, since it's offset
                 * will be invalid once this delete method runs
                 *
                 * // since we only added one char, we should only have to remove one
                 * if (buffer.length() > BUFFERMAX)
                 *     buffer.delete(0, BUFFERMAX - buffer.length());
                 */

                logger.trace("BlockingConsumer " + this + " notifying listeners of buffer change");
                notify(); // seeing that we read something, wake people up

                // We explicitly call this after appending to the
                // buffer, just in case one of the BufferChangeLoggers
                // accidentally modifies the character buffer.
                notifyBufferChange(cs, length);
            } // end synchronized(this)
        } // end while loop

        logger.trace("BlockingConsumer " + this + " notifying listeners upon ceasing");
        synchronized(this) {
            notify();
        }

        if (stopRequested) {
            logger.debug("BlockingConsumer " + this + " stop requested");
            pair.close();
        }

        if (foundEOF)
            logger.debug("BlockingConsumer " + this + " found EOF to stop while loop");
    }

    /**
     * TODO: what if something came in between when we last checked and
     *       when this method is called
     *
     * @param timeout timeout in milliseconds
     */
    public void waitForBuffer(long timeout) {
        if (foundEOF) {
            logger.trace("BlockingConsumer " + this + " wanted to wait for buffer but found EOF");
            return;
        }

        logger.trace("BlockingConsumer " + this + " ynching on this to wait");
        logger.trace("BlockingConsumer " + this + " waiting for synchronized access before waiting");
        synchronized(this) {
            try {
                if (timeout > 0) {
                    logger.trace("BlockingConsumer " + this + " waiting for " + timeout + " msec for some additional event");
                    wait(timeout);
                } else {
                    logger.trace("BlockingConsumer " + this + " waiting forever for some additional event");
                    wait();
                }
            } catch (InterruptedException ie) {
                logger.trace("BlockingConsumer " + this + " woken up while waiting for buffer");
            }
        }
    }

    /**
     * TODO
     *
     * @return TODO
     */
    public String pause() {
        // TODO mark offset, so that it can be trimmed by resume coming in later
        String currentBuffer;
        currentBuffer = buffer.toString();
        return currentBuffer;
    }

    /**
     * Resume processing from the specified offset.
     *
     * @param offset the offset into the buffer (1-indexed) from which
     *               to start
     */
    public void resume(int offset) {
        if (offset < 0)
            return;

        synchronized(this) {
            logger.trace("BlockingConsumer " + this + " moving buffer up by " + offset);
            StringBuffer smaller = buffer.delete(0, offset); // + 1
        }
    }

    /**
     * A method to test the <code>BlockingConsumer</code> class independently.
     *
     * @param args command line arguments (none used)
     */
    public static void main(String args[]) throws Exception {
        final StringBuffer buffer = new StringBuffer("The lazy fox");

        Thread t1 = new Thread() {
            public void run() {
                synchronized(buffer) {
                    buffer.delete(0,4);
                    buffer.append(" in the middle");
                    System.err.println("Middle");
                    try {
                        Thread.sleep(4000);
                    } catch (Exception e) {}
                    buffer.append(" of fall");
                    System.err.println("Fall");
                }
            }
        };

        Thread t2 = new Thread() {
            public void run() {
                try {
                    Thread.sleep(1000);
                } catch (Exception e) {}
                buffer.append(" jump over the fence");
                System.err.println("Fence");
            }
        };

        t1.start();
        t2.start();

        t1.join();
        t2.join();

        System.err.println(buffer);
    }
}
938594
def _handle_processing_error(err, errstream, client):
    """"""

    errors = sorted(err.events, key=operator.attrgetter("index"))
    failed = [e.event for e in errors]
    silent = all(isinstance(e.error, OutOfOrderError) for e in errors)
    if errstream:
        _deliver_errored_events(errstream, failed)
        must_raise = False
    else:
        must_raise = True
    for _, event, error, tb in errors:
        if isinstance(error, OutOfOrderError):
            # Not really an error: do not log this to Sentry
            continue
        try:
            raise six.reraise(*tb)
        except Exception as err:
            if client:
                client.captureException()
            msg = "{}{}: {}".format(type(err).__name__,
                    err.args, json.dumps(event, indent=4))
            rlogger.error(msg, exc_info=tb)
            if must_raise:
                raise
141002
public final void evalError() throws IOException {
    final List<EvaluationMonitor<SequenceLabelSample>> listeners = new LinkedList<EvaluationMonitor<SequenceLabelSample>>();
    listeners.add(new SequenceLabelerEvaluationErrorListener());
    final SequenceLabelerEvaluator evaluator = new SequenceLabelerEvaluator(this.corpusFormat,
        this.sequenceLabeler, listeners
            .toArray(new SequenceLabelerEvaluationMonitor[listeners.size()]));
    evaluator.evaluate(this.testSamples);
    System.out.println(evaluator.getFMeasure());
  }
608170
public <T> void addParser(Class<T> clazz, StringParser<T> parser) {
		parsers.put(clazz, parser);
	}
1229441
def main():
    """"""
    parser, args = parser_factory()
    try:
        action_runner(parser, args)

    # this is our uncaught handler so yes we want to actually
    # catch every error. the format may vary based on the error handler tho
    except Exception as uncaught:  # pylint: disable=broad-except
        unhandled(uncaught, args)
        sys.exit(1)