vitess.io/vitess@v0.16.2/go/vt/vtadmin/errors/errors.go (about)

     1  /*
     2  Copyright 2020 The Vitess Authors.
     3  
     4  Licensed under the Apache License, Version 2.0 (the "License");
     5  you may not use this file except in compliance with the License.
     6  You may obtain a copy of the License at
     7  
     8      http://www.apache.org/licenses/LICENSE-2.0
     9  
    10  Unless required by applicable law or agreed to in writing, software
    11  distributed under the License is distributed on an "AS IS" BASIS,
    12  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    13  See the License for the specific language governing permissions and
    14  limitations under the License.
    15  */
    16  
    17  package errors
    18  
    19  import (
    20  	"errors"
    21  	"fmt"
    22  )
    23  
    24  // Errors returned by API endpoints.
    25  var (
    26  	// ErrAmbiguousSchema occurs when more than one schema is found for a given
    27  	// set of filter criteria.
    28  	ErrAmbiguousSchema = errors.New("multiple schemas found")
    29  	// ErrAmbiguousTablet occurs when more than one tablet is found for a given
    30  	// set of filter criteria.
    31  	ErrAmbiguousTablet = errors.New("multiple tablets found")
    32  	// ErrAmbiguousWorkflow occurs when more than one workflow is found for a
    33  	// set of filter criteria that should ordinarily never return more than one
    34  	// workflow.
    35  	ErrAmbiguousWorkflow = errors.New("multiple workflows found")
    36  	// ErrInvalidRequest occurs when a request is invalid for any reason.
    37  	// For example, if mandatory parameters are undefined.
    38  	ErrInvalidRequest = errors.New("Invalid request")
    39  	// ErrNoServingTablet occurs when a tablet with state SERVING cannot be
    40  	// found for a given set of filter criteria. It is a more specific form of
    41  	// ErrNoTablet
    42  	ErrNoServingTablet = fmt.Errorf("%w with state=SERVING", ErrNoTablet)
    43  	// ErrNoSrvVSchema occurs when no SrvVSchema is found for a given keyspace.
    44  	ErrNoSrvVSchema = errors.New("SrvVSchema not found")
    45  	// ErrNoTablet occurs when a tablet cannot be found for a given set of
    46  	// filter criteria.
    47  	ErrNoTablet = errors.New("no such tablet")
    48  	// ErrNoWorkflow occurs when a workflow cannot be found for a given set of
    49  	// filter criteria.
    50  	ErrNoWorkflow = errors.New("no such workflow")
    51  	// ErrUnauthorized occurs when attempting to perform a (subject, resource, action)
    52  	// in a cluster that the rbac configuration does not allow.
    53  	ErrUnauthorized = errors.New("unauthorized")
    54  	// ErrUnsupportedCluster occurs when a cluster parameter is invalid.
    55  	ErrUnsupportedCluster = errors.New("unsupported cluster(s)")
    56  )
    57  
    58  // Errors returned by cluster setup and flag parsing.
    59  var (
    60  	// ErrNoFlag occurs when cluster config parsing encounters a flag specified
    61  	// in the DSN that is not defined.
    62  	ErrNoFlag = errors.New("flag provided but not defined")
    63  )