def _handle_processing_error(err, errstream, client):
errors = sorted(err.events, key=operator.attrgetter("<STR_LIT:index>"))<EOL>failed = [e.event for e in errors]<EOL>silent = all(isinstance(e.error, OutOfOrderError) for e in errors)<EOL>if errstream:<EOL><INDENT>_deliver_errored_events(errstream, failed)<EOL>must_raise = False<EOL><DEDENT>else:<EOL><INDENT>must_raise = True<EOL><DEDENT>for _, event, error, tb in errors:<EOL><INDENT>if isinstance(error, OutOfOrderError):<EOL><INDENT>continue<EOL><DEDENT>try:<EOL><INDENT>raise six.reraise(*tb)<EOL><DEDENT>except Exception as err:<EOL><INDENT>if client:<EOL><INDENT>client.captureException()<EOL><DEDENT>msg = "<STR_LIT>".format(type(err).__name__,<EOL>err.args, json.dumps(event, indent=<NUM_LIT:4>))<EOL>rlogger.error(msg, exc_info=tb)<EOL>if must_raise:<EOL><INDENT>raise<EOL><DEDENT><DEDENT><DEDENT>
Handle ProcessingError exceptions.