Deliberately only catches `Exception` objects rather than all throwables.

Exceptions are more likely to mean that something went wrong in the reporter
vs an error (which probably means the programmer messed up).
14137
private function reportOn(MetricSet $set) : array
    {
        $errors = [];
        foreach ($this->reporters as $reporter) {
            try {
                $reporter->reportOn($set);
            } catch (\Exception $e) {
                $errors[] = $e;
            }
        }

        return $errors;
    }
482417
def _catch(f, exception_type):
  """"""
  if not (inspect.isclass(exception_type)
          and issubclass(exception_type, Exception)):
    exception_type = Exception

  @functools.wraps(f)
  def wrap(*args, **kw):
    try:
      return f(*args, **kw)
    except exception_type as e:  # pylint: disable=broad-except
      qj(e, 'Caught an exception in %s' % f, d=1, _depth=2)
  return wrap
222954
def exception(self, event=None, *args, **kw):
        
        if not self._logger.isEnabledFor(logging.ERROR):
            return

        kw = self._add_base_info(kw)
        kw['level'] = "exception"
        kw.setdefault('exc_info', True)
        return self.error(event, *args, **kw)
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
323867
public boolean matches(Object obj) {
        if (!(obj instanceof Exception))
            return false;

        Exception exception = (Exception) obj;

        return exception.getCause() == null;
    }
190557
private static boolean isPermanentError(Throwable throwable) {
    Status status = getStatus(throwable);

    switch (status.getCode()) {
      case CANCELLED:
      case UNKNOWN:
      case DEADLINE_EXCEEDED:
      case RESOURCE_EXHAUSTED:
      case INTERNAL:
      case UNAVAILABLE:
      case UNAUTHENTICATED:
        return false;
      default:
        return true;
    }
  }
1037632
def catch(ignore=[],
          was_doing="something important",
          helpfull_tips="you should use a debugger",
          gbc=None):
    
    exc_cls, exc, tb=sys.exc_info()
    if exc_cls in ignore:
        msg='exception in ignorelist'
        gbc.say('ignoring caught:'+str(exc_cls))
        return 'exception in ignorelist'
        

    ex_message = traceback.format_exception_only(exc_cls, exc)[-1]
    ex_message = ex_message.strip()
    
    # TODO: print(ex_message)

    error_frame = tb
    while error_frame.tb_next is not None:
        error_frame = error_frame.tb_next

    file = error_frame.tb_frame.f_code.co_filename
    line = error_frame.tb_lineno
    stack = traceback.extract_tb(tb)

    formated_stack = []
    for summary in stack:
        formated_stack.append({
            'file': summary[0],
            'line': summary[1],
            'func': summary[2],
            'text': summary[3]
        })

    event = {
        'was_doing':was_doing,
        'message': ex_message,
        'errorLocation': {
            'file': file,
            'line': line,
            'full': file + ' -> ' + str(line)
        },
        'stack': formated_stack
        #,
        #'time': time.time()
    }

    try:
        #logging.info('caught:'+pformat(event))
        gbc.cry('caught:'+pformat(event))
        print('Bubble3: written error to log')
        print('Bubble3: tips for fixing this:')
        print(helpfull_tips)

    except Exception as e:
        print('Bubble3: cant log error cause of %s' % e)
474606
private boolean handleException(final Throwable t,
                                  final HttpServletResponse resp,
                                  final boolean serverError) {
    if (serverError) {
      return true;
    }

    try {
      error(t);
      sendError(t, resp);
      return true;
    } catch (Throwable t1) {
      // Pretty much screwed if we get here
      return true;
    }
  }
249032
public static <T extends Exception> void exception(Class<T> exceptionClass, ExceptionHandler<? super T> handler) {
        getInstance().exception(exceptionClass, handler);
    }
121053
public boolean hasException(Class<? extends Throwable> type) {
        for (Throwable exception : exceptions) {
            if (type.isInstance(exception)) {
                return true;
            }
        }
        
        return false;
    }
786611
public void reportError(Throwable t) {
		// set the exception, if it is the first (and the exception is non null)
		if (t != null && exception.compareAndSet(null, t) && toInterrupt != null) {
			toInterrupt.interrupt();
		}
	}
395853
public void exception(Throwable e) {
    final String msg = e.getMessage();
    log(Level.SEVERE, msg != null ? msg : "An exception occurred.", e);
  }
428613
void reportError(Throwable throwable) {
    if (logger != null)
      logger.error("Timer reported error", throwable);
    status = "Thread blocked on error: " + throwable;
    error_skips = error_factor;
  }
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
1307573
@Override
    @CallerSideMethod public void onError(Throwable throwable) {
        if ( throwable == null )
            throw null;
        _onError(throwable);
    }
549919
public boolean socketError(Throwable throwable) {
    if (throwable instanceof SocketException || throwable instanceof SocketTimeoutException) {
      return true;
    }
    Throwable cause = throwable.getCause();
    // Subset of SSL exceptions that are caused by IO errors (e.g. SSLHandshakeException due to
    // unexpected connection closure) is also a socket error.
    if (throwable instanceof SSLException && cause != null && ioError(cause)) {
      return true;
    }
    return cause != null && socketError(cause);
  }
957472
private void reportable() {
        final SimpleOutput reportable = new SimpleOutput();
        reportable.setErrorStream(System.err);
        reportable.setOutputStream(System.out);
        setReportable(reportable);
    }