HEX
Server: Apache/2.4.65 (Ubuntu)
System: Linux ielts-store-v2 6.8.0-1036-gcp #38~22.04.1-Ubuntu SMP Thu Aug 14 01:19:18 UTC 2025 x86_64
User: root (0)
PHP: 7.2.34-54+ubuntu20.04.1+deb.sury.org+1
Disabled: pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,
Upload Files
File: //snap/google-cloud-cli/current/lib/googlecloudsdk/command_lib/concepts/exceptions.py
# -*- coding: utf-8 -*- #
# Copyright 2018 Google LLC. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#    http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
"""Exceptions for concept args."""

from __future__ import absolute_import
from __future__ import division
from __future__ import unicode_literals

from googlecloudsdk.core import exceptions


class Error(exceptions.Error):
  """Base class for errors in this module."""


class ConstraintError(Error):
  """Error when converting a constraint."""

  def __init__(self, concept_name, kind, string, message):
    super(ConstraintError, self).__init__(
        'Invalid {} [{}] for [{}]. {}'.format(
            kind, string, concept_name, message))


class ParseError(Error):
  """Error when parsing a concept."""

  def __init__(self, concept_name, message):
    super(ParseError, self).__init__(
        'Failed to parse [{}]. {}'.format(concept_name, message))


class ValidationError(Error):
  """Error when validating a concept."""

  def __init__(self, concept_name, message):
    super(ValidationError, self).__init__(
        'Failed to validate [{}]. {}'.format(concept_name, message))


class InitializationError(Error):
  """Error when a concept was initialized with an invalid value."""


class MissingRequiredArgumentError(Error):
  """Error when a required concept can't be found."""

  def __init__(self, concept_name, message):
    super(MissingRequiredArgumentError, self).__init__(
        'No value was provided for [{}]: {}'.format(concept_name, message))


class ModalGroupError(Error):
  """Error when a modal group was not specified correctly."""

  def __init__(self, concept_name, specified, missing):
    super(ModalGroupError, self).__init__(
        'Failed to specify [{}]: '
        '{specified}: {missing} must be specified.'
        .format(concept_name, specified=specified, missing=missing))


class OptionalMutexGroupError(Error):
  """Error when an optional mutex group was not specified correctly."""

  def __init__(self, concept_name, conflict):
    super(OptionalMutexGroupError, self).__init__(
        'Failed to specify [{}]: At most one of {conflict} can be specified.'
        .format(concept_name, conflict=conflict))


class RequiredMutexGroupError(Error):
  """Error when a required mutex group was not specified correctly."""

  def __init__(self, concept_name, conflict):
    super(RequiredMutexGroupError, self).__init__(
        'Failed to specify [{}]: Exactly one of {conflict} must be specified.'
        .format(concept_name, conflict=conflict))