Return Error for first crashed observable.

 Should only be used if error?

 @return [Exception, nil]
541254
def error
      @values.each_pair{|observable, value|
        return Error.new(observable, value) if Exception === value
      }
      return nil
    end
1318223
function _parseErrors() {
    let errors = [].slice.call(arguments);
    let parsed = [];

    errors.forEach(err => {
        let message = (err instanceof Error) ? err.stack : err.toString();
        parsed.push(message);
    });

    return parsed;
}
950312
function (onNext, onError) {
        var self = this, subscriber = new Observable();
        subscriber._onNext = onNext;
        subscriber._onError = onError;
        subscriber._nextErr = genNextErr(subscriber.next);

        subscriber.publisher = self;
        self.subscribers.push(subscriber);

        return subscriber;
    }
441874
def parse_error(response_lines)
      first_line = response_lines.shift

      return nil if first_line == 'OK'
      return Errors::SyncError.new if first_line == 'SYNC ERROR'

      if first_line == 'ERROR'
        error_code = response_lines.shift
        LightstreamerError.build response_lines.shift, error_code
      else
        LightstreamerError.new first_line
      end
    end
777721
def error(message, url, line, column, key)
      @procs[:html_parser].each { |handler| handler.call(message, url, line, column, key) }
    end
1171323
def local_on_error(err)

      if h.on_error.is_a?(String) or Ruote.is_tree?(h.on_error)

        return h.on_error
      end

      if h.on_error.is_a?(Array)

        # all for the 'on_error' expression
        # see test/functional/eft_38_

        h.on_error.each do |oe|

          if (he = HandlerEntry.new(oe)).match(err)
            return he.narrow
          end
        end
      end

      nil
    end
642316
def check_failures(object)
      check object
    rescue CheckFailed => e
      return e.errors.map { |e| e.protocol_message }
    end
211795
def errors
      if response.decoded_body
        response.decoded_body['errors'] ||
          response.decoded_body[:errors] ||
          response.decoded_body
      else
        response.body
      end
    end
786718
private <T> Observable<T> bluetoothAdapterOffExceptionObservable() {
        return rxBleAdapterStateObservable
                .filter(new Predicate<BleAdapterState>() {
                    @Override
                    public boolean test(BleAdapterState state) throws Exception {
                        return state != BleAdapterState.STATE_ON;
                    }
                })
                .firstElement()
                .flatMap(new Function<BleAdapterState, MaybeSource<T>>() {
                    @Override
                    public MaybeSource<T> apply(BleAdapterState bleAdapterState) throws Exception {
                        return Maybe.error(new BleScanException(BleScanException.BLUETOOTH_DISABLED));
                    }
                })
                .toObservable();
    }
43205
def CATCH(exception_klass, &block)
      block.call
    rescue ::Exception
      if $!.instance_of? exception_klass
        pass
      else
        failure("Faced a exception, that instance of #{exception_klass}.",
                "Faced a exception, that instance of #{$!.class}.", 2)
      end
    else
      failure("Faced a exception, that instance of #{exception_klass}.",
              'The block was not faced any exceptions.', 2)
    ensure
      _declared!
    end
717762
def print_unexpected_exception(exception) # rubocop:disable Metrics/AbcSize
      log.bold_error exception.message
      log.error exception.backtrace.join("\n")
      log.warning 'Report this bug at ', false
      log.info HamlLint::BUG_REPORT_URL
      log.newline
      log.success 'To help fix this issue, please include:'
      log.log '- The above stack trace'
      log.log '- Haml-Lint version: ', false
      log.info HamlLint::VERSION
      log.log '- Haml version: ', false
      log.info Gem.loaded_specs['haml'].version
      log.log '- RuboCop version: ', false
      log.info Gem.loaded_specs['rubocop'].version
      log.log '- Ruby version: ', false
      log.info RUBY_VERSION
    end
164085
def evaluate_exceptions(exceptions, options)
      exceptions.each do |exception|
        key = if exception.is_a?(Class) && exception <= Exception
          exception.name
        elsif exception.is_a?(String)
          exception
        else
          raise ArgumentError, "#{exception} isn't an Exception"
        end

        error_handlers << [key, options[:with]]
      end
    end
49755
def handle_exception(example)
      if example.instance_variable_get(:@exception)
        if metadata[:background]
          skip_examples_after(example, ancestors[1])
        else
          skip_examples_after(example)
        end
      end
    end
39311
function errnoException(err, syscall, original) {
  // TODO(joyeecheung): We have to use the type-checked
  // getSystemErrorName(err) to guard against invalid arguments from users.
  // This can be replaced with [ code ] = errmap.get(err) when this method
  // is no longer exposed to user land.
  if (util === undefined) util = require('util');
  const code = util.getSystemErrorName(err);
  const message = original ?
    `${syscall} ${code} ${original}` : `${syscall} ${code}`;

  // eslint-disable-next-line no-restricted-syntax
  const ex = new Error(message);
  // TODO(joyeecheung): errno is supposed to err, like in uvException
  ex.code = ex.errno = code;
  ex.syscall = syscall;

  Error.captureStackTrace(ex, errnoException);
  return ex;
}
1343962
def exceptionCaught(self, exc=None, **kwargs):
        ''
        if isinstance(exc, ExpectedException):  # already reported, don't log
            return
        self.lastErrors.append(stacktrace())
        if kwargs.get('status', True):
            status(self.lastErrors[-1][-1], priority=2)  # last line of latest error
        if options.debug:
            raise
291518
def exception_cause(exception)
      e = exception
      if e.respond_to?(:cause) && e.cause && e.cause.is_a?(Exception)
        e.cause
      elsif e.respond_to?(:original_exception) && e.original_exception && e.original_exception.is_a?(Exception)
        e.original_exception
      elsif e.respond_to?(:continued_exception) && e.continued_exception && e.continued_exception.is_a?(Exception)
        e.continued_exception
      end
    end
1044819
def server_error_handling(&blk)
    begin
      blk.call
    rescue Sequel::DatabaseError => e
      if e.message =~ /duplicate key value/i
        raise Taps::DuplicatePrimaryKeyError, e.message
      else
        raise
      end
    end
  end