def _check_context()

in modular-service-cli/modular_service_cli/group/__init__.py [0:0]


    def _check_context(self, ctx: click.Context):
        """
        May raise click.UsageError
        :param ctx:
        :return:
        """
        obj: ContextObj = cast(ContextObj, ctx.obj)
        config = obj.config
        if self._check_api_link and not config.api_link:
            raise click.UsageError(
                'Modular service API link is not configured. '
                'Run \'modular-service configure\' and try again.'
            )
        if self._check_access_token and not config.access_token:
            raise click.UsageError(
                'Modular access token not found. '
                'Run \'modular-service login\' to receive the token'
            )