Need to wrap the default call to handle exceptions.
350734
def create(self, name, *args, **kwargs):
        
        try:
            return super(ImageMemberManager, self).create(name, *args, **kwargs)
        except Exception as e:
            if e.http_status == 403:
                raise exc.UnsharableImage("You cannot share a public image.")
            else:
                raise
886206
def _create_capture_exceptions(capture_decider: Callable[[BaseException], bool]) -> Callable:
        
        def wrapped(*args, **kwargs):
            result = CaptureWrapBuilder._capture_exceptions(*args, **kwargs)
            if result.exception is not None:
                if not capture_decider(result.exception):
                    raise result.exception
            return result

        return wrapped
404788
def safecall(func):
    """"""
    def wrapper(*args, **kwargs):
        try:
            return func(*args, **kwargs)
        except Exception:
            pass
    return wrapper
917323
private static <E extends Throwable> E wrapIfNecessary(Throwable throwable)
			throws RetryException {
		if (throwable instanceof Error) {
			throw (Error) throwable;
		}
		else if (throwable instanceof Exception) {
			@SuppressWarnings("unchecked")
			E rethrow = (E) throwable;
			return rethrow;
		}
		else {
			throw new RetryException("Exception in retry", throwable);
		}
	}
78759
private void handleException(final Throwable e)
    {
        if ( errorListeners.size() == 0 )
        {
            LOG.error("", e);
        }
        else
        {
            errorListeners.forEach(new Function<UnhandledErrorListener, Void>()
            {
                @Override
                public Void apply(UnhandledErrorListener listener)
                {
                    try
                    {
                        listener.unhandledError("", e);
                    }
                    catch ( Exception e )
                    {
                        ThreadUtils.checkInterrupted(e);
                        LOG.error("Exception handling exception", e);
                    }
                    return null;
                }
            });
        }
    }
563133
def default_value(self):
        
        if self.has_default:
            if hasattr(self.default, '__call__'):
                return self.default()
            else:
                return self.default
        else:
            raise Exception("No default value specified")
5678
def make_wrapper(self, callable_):
        """"""
        assert callable(callable_)
        def wrapper(*args, **kw):
            return self.call_and_report_errors(callable_, *args, **kw)
        return wrapper
976789
def normalize_exceptions(func):
    """"""
    @wraps(func)
    def wrapper(*args, **kwargs):
        message = "Whoa, you found a bug."
        try:
            return func(*args, **kwargs)
        except requests.HTTPError as err:
            raise CommError(err.response, err)
        except RetryError as err:
            if "response" in dir(err.last_exception) and err.last_exception.response is not None:
                try:
                    message = err.last_exception.response.json().get(
                        'errors', [{'message': message}])[0]['message']
                except ValueError:
                    message = err.last_exception.response.text
            else:
                message = err.last_exception

            six.reraise(CommError, CommError(
                message, err.last_exception), sys.exc_info()[2])
        except Exception as err:
            # gql raises server errors with dict's as strings...
            if len(err.args) > 0:
                payload = err.args[0]
            else:
                payload = err
            if str(payload).startswith("{"):
                message = ast.literal_eval(str(payload))["message"]
            else:
                message = str(err)
            if wandb.env.is_debug():
                six.reraise(*sys.exc_info())
            else:
                six.reraise(CommError, CommError(
                    message, err), sys.exc_info()[2])
    return wrapper
103622
public static void setDefaultUncaughtExceptionHandler (@Nonnull final Thread.UncaughtExceptionHandler aHdl)
  {
    ValueEnforcer.notNull (aHdl, "DefaultUncaughtExceptionHandler");
    s_aDefaultUncaughtExceptionHandler = aHdl;
  }
19127
function wrapReturn(trace, clientState, hooks, rules){
  if (util.isFunction(trace.ret) && !trace.ret.__concurix_blacklisted) {
    wrapFunctions(trace.moduleName, trace.ret, -1, hooks, clientState, rules );
    trace.ret = wrap(trace.ret)
          .before(hooks.beforeHook)
          .after(hooks.afterHook)
          .state(clientState)
          .nameIfNeeded(trace.moduleName)
          .module(trace.moduleName)
          .getProxy();
  } else {
    wrapFunctions(trace.moduleName, trace.ret, -1, hooks, clientState, rules );
  }
}
1197290
def default_errorhandler(self, f):
        
        for http_code in default_exceptions:
            self.error_handler_spec[None][http_code] = f
        return f
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
209961
function raise(err, parameters, cause) {
  if(!(err instanceof Error)) {
    err = wrap(err, parameters, cause);
  }
  throw err;
}
1287659
def exception_wrapper(f):
    """"""
    @wraps(f)
    def wrapper(*args, **kwds):
        try:
            return f(*args, **kwds)
        except dbus.exceptions.DBusException as err:
            _args = err.args
            raise PyMPRISException(*_args)
    return wrapper
617049
private void trySetDefault(Object bean1) throws IllegalAccessError {
        try {
            doSetDefault(bean1);
        } catch (IllegalAccessException ex) {
            try {
                // try again
                f.setAccessible(true);
                doSetDefault(bean1);
            }catch (IllegalAccessException ex1) {
                throw new IllegalAccessError(ex1.getMessage());
            }
        }
    }
394438
public static <V> Callable<V> wrap(final Callable<V> callable) {
		final String suffix = Log.suffix.get();
		// t.getCause() is atop t, see Log.concat() for more details
		final Throwable t = new Throwable(Log.throwable.get());
		return new Callable<V>() {
			@Override
			public V call() throws Exception {
				threadNum.incrementAndGet();
				Log.suffix.set(suffix);
				Log.throwable.set(t);
				try {
					return callable.call();
				} catch (Error e) {
					throw new Exception(e);
				} finally {
					Log.throwable.remove();
					Log.suffix.remove();
					threadNum.decrementAndGet();
				}
			}
		};
	}
633326
def decorate_callable(self, callable_):
        """"""
        @wraps(callable_)
        def decorated(*args, **kwargs):
            # Extract timeout from request itself or use default for ioloop wrapper
            timeout = kwargs.get('timeout')
            return self.call_in_ioloop(callable_, args, kwargs, timeout)

        decorated.__doc__ = '\n\n'.join((
"""Wrapped async call. Will call in ioloop.

This call will block until the original callable has finished running on the ioloop, and
will pass on the return value. If the original callable returns a future, this call will
wait for the future to resolve and return the value or raise the exception that the future
resolves with.

Original Callable Docstring
---------------------------
""",
            textwrap.dedent(decorated.__doc__ or '')))

        return decorated