Raise an exception if the container does not exist
501663
def _ensure_exists(name, path=None):
    '''
    
    '''
    if not exists(name, path=path):
        raise CommandExecutionError(
            'Container \'{0}\' does not exist'.format(name)
        )
661418
async def run(self, config, *, name=None):
        
        try:
            container = await self.create(config, name=name)
        except DockerError as err:
            # image not find, try pull it
            if err.status == 404 and "Image" in config:
                await self.docker.pull(config["Image"])
                container = await self.create(config, name=name)
            else:
                raise err

        try:
            await container.start()
        except DockerError as err:
            raise DockerContainerError(
                err.status, {"message": err.message}, container["id"]
            )

        return container
1284947
def assert_or_raise(stmt: bool, exception: Exception,
                    *exception_args, **exception_kwargs) -> None:
  
  if not stmt:
    raise exception(*exception_args, **exception_kwargs)
201253
def check_starting!(service_pod, container)
      raise "service stopped" if !@service_pod.running?
      raise "service redeployed" if @service_pod.deploy_rev != service_pod.deploy_rev
      raise "container recreated" if @container.id != container.id
      raise "container restarted" if @container.started_at != container.started_at
    end
1367191
def respond_to_missing?(name, include_private = false)
      known_action?(name) ||
        known_resource?(name) ||
        known_exception?(name) ||
        super
    end
215747
def raises_gathered(error_type):
    ''''''
    container = RaisesGatheredContainer()
    try:
        yield container
    except GatheredExceptions as e:
        # Make sure there is exactly one exception.
        if len(e.exceptions) != 1:
            raise
        inner = e.exceptions[0]
        # Make sure the exception is the right type.
        if not isinstance(inner, error_type):
            raise
        # Success.
        container.exception = inner
1194896
def internal_assert(condition, message=None, item=None, extra=None):
    """"""
    if DEVELOP and callable(condition):
        condition = condition()
    if not condition:
        if message is None:
            message = "assertion failed"
            if item is None:
                item = condition
        raise CoconutInternalException(message, item, extra)
680681
def _set_exception(self):
        """"""
        assert not self.ready()
        self._data = sys.exc_info()
        self._success = False
        self._event.set()
        if self._collector is not None:
            self._collector.notify_ready(self)
209961
function raise(err, parameters, cause) {
  if(!(err instanceof Error)) {
    err = wrap(err, parameters, cause);
  }
  throw err;
}
965055
def ensure_container(self, name=None):
        """"""
        if get_lxc_version() < pkg_resources.parse_version('2.0.0'):
            # Nothing to do for old versions of LXC
            return

        if name is None:
            name = self.container_name

        args = [
            'lxc-create',
            '--name', name,
            '--template', 'none',
            '>', '/dev/null', '2>&1',
        ]
        os.system(' '.join(args))
1055200
def _raise_if_error(self):
        
        retcode = self.process.poll()
        if retcode is not None and retcode != 0:
            message = self._stderr.read().strip()
            raise IOError(message)
923864
def raise_for_missing_namespace(self, line: str, position: int, namespace: str, name: str) -> None:
        """"""
        if not self.has_namespace(namespace):
            raise UndefinedNamespaceWarning(self.get_line_number(), line, position, namespace, name)
895406
def check(self, check, member, missing=False):
        """"""
        if missing:
            raise self.baseErrorClass()
        return member
1049396
def template_exception_handler(fn, error_context, filename=None):
    """"""
    error_message = None
    if filename:
        error_context.update(filename=filename)
    try:
        return fn()
    except jinja2.TemplateSyntaxError as exc:
        error_context.update(filename=exc.filename, line_no=exc.lineno)
        error_message = exc.message
    except jinja2.TemplateError as exc:
        error_message = exc.message
    except Exception as exc:
        error_message = "%s" % exc

    raise TemplateError(message=error_message, context=error_context)
248130
def _raise_or_append_exception(self):
        
        message = (
            'Connection dead, no heartbeat or data received in >= '
            '%ds' % (
                self._interval * 2
            )
        )
        why = AMQPConnectionError(message)
        if self._exceptions is None:
            raise why
        self._exceptions.append(why)
1181725
def _raise_error(self, *args, **kwargs):
        
        log.debug("_raise_error(): %s" % kwargs)
        try:
            error_code = str(kwargs['code'])
        except KeyError as e:
            raise FaultyPayloadError('_raise_error(): %s' % kwargs)

        try:
            raise self._code_handlers[error_code]()
        except KeyError:
            raise UnknownWSSError()
1253434
def raise_failure_exception(self, expect_or_allow='Allowed'):
        

        raise MockExpectationError(
            "{} '{}' to be called {}on {!r} with {}, but was not. ({}:{})".format(
                expect_or_allow,
                self._method_name,
                self._call_counter.error_string(),
                self._target.obj,
                self._expected_argument_string(),
                self._caller.filename,
                self._caller.lineno,
            )
        )