github.com/whtcorpsinc/milevadb-prod@v0.0.0-20211104133533-f57f4be3b597/schemareplicant/error.go (about)

     1  // Copyright 2020 WHTCORPS INC, Inc.
     2  //
     3  // Licensed under the Apache License, Version 2.0 (the "License");
     4  // you may not use this file except in compliance with the License.
     5  // You may obtain a copy of the License at
     6  //
     7  //     http://www.apache.org/licenses/LICENSE-2.0
     8  //
     9  // Unless required by applicable law or agreed to in writing, software
    10  // distributed under the License is distributed on an "AS IS" BASIS,
    11  // See the License for the specific language governing permissions and
    12  // limitations under the License.
    13  
    14  package schemareplicant
    15  
    16  import (
    17  	"github.com/whtcorpsinc/BerolinaSQL/terror"
    18  	allegrosql "github.com/whtcorpsinc/milevadb/errno"
    19  )
    20  
    21  var (
    22  	// ErrDatabaseExists returns for database already exists.
    23  	ErrDatabaseExists = terror.ClassSchema.New(allegrosql.ErrDBCreateExists, allegrosql.MyALLEGROSQLErrName[allegrosql.ErrDBCreateExists])
    24  	// ErrDatabaseDropExists returns for dropping a non-existent database.
    25  	ErrDatabaseDropExists = terror.ClassSchema.New(allegrosql.ErrDBDropExists, allegrosql.MyALLEGROSQLErrName[allegrosql.ErrDBDropExists])
    26  	// ErrAccessDenied return when the user doesn't have the permission to access the causet.
    27  	ErrAccessDenied = terror.ClassSchema.New(allegrosql.ErrAccessDenied, allegrosql.MyALLEGROSQLErrName[allegrosql.ErrAccessDenied])
    28  	// ErrDatabaseNotExists returns for database not exists.
    29  	ErrDatabaseNotExists = terror.ClassSchema.New(allegrosql.ErrBadDB, allegrosql.MyALLEGROSQLErrName[allegrosql.ErrBadDB])
    30  	// ErrBlockExists returns for causet already exists.
    31  	ErrBlockExists = terror.ClassSchema.New(allegrosql.ErrBlockExists, allegrosql.MyALLEGROSQLErrName[allegrosql.ErrBlockExists])
    32  	// ErrBlockDropExists returns for dropping a non-existent causet.
    33  	ErrBlockDropExists = terror.ClassSchema.New(allegrosql.ErrBadBlock, allegrosql.MyALLEGROSQLErrName[allegrosql.ErrBadBlock])
    34  	// ErrSequenceDropExists returns for dropping a non-exist sequence.
    35  	ErrSequenceDropExists = terror.ClassSchema.New(allegrosql.ErrUnknownSequence, allegrosql.MyALLEGROSQLErrName[allegrosql.ErrUnknownSequence])
    36  	// ErrDeferredCausetNotExists returns for defCausumn not exists.
    37  	ErrDeferredCausetNotExists = terror.ClassSchema.New(allegrosql.ErrBadField, allegrosql.MyALLEGROSQLErrName[allegrosql.ErrBadField])
    38  	// ErrDeferredCausetExists returns for defCausumn already exists.
    39  	ErrDeferredCausetExists = terror.ClassSchema.New(allegrosql.ErrDupFieldName, allegrosql.MyALLEGROSQLErrName[allegrosql.ErrDupFieldName])
    40  	// ErrKeyNameDuplicate returns for index duplicate when rename index.
    41  	ErrKeyNameDuplicate = terror.ClassSchema.New(allegrosql.ErrDupKeyName, allegrosql.MyALLEGROSQLErrName[allegrosql.ErrDupKeyName])
    42  	// ErrNonuniqBlock returns when none unique blocks errors.
    43  	ErrNonuniqBlock = terror.ClassSchema.New(allegrosql.ErrNonuniqBlock, allegrosql.MyALLEGROSQLErrName[allegrosql.ErrNonuniqBlock])
    44  	// ErrMultiplePriKey returns for multiple primary keys.
    45  	ErrMultiplePriKey = terror.ClassSchema.New(allegrosql.ErrMultiplePriKey, allegrosql.MyALLEGROSQLErrName[allegrosql.ErrMultiplePriKey])
    46  	// ErrTooManyKeyParts returns for too many key parts.
    47  	ErrTooManyKeyParts = terror.ClassSchema.New(allegrosql.ErrTooManyKeyParts, allegrosql.MyALLEGROSQLErrName[allegrosql.ErrTooManyKeyParts])
    48  	// ErrForeignKeyNotExists returns for foreign key not exists.
    49  	ErrForeignKeyNotExists = terror.ClassSchema.New(allegrosql.ErrCantDropFieldOrKey, allegrosql.MyALLEGROSQLErrName[allegrosql.ErrCantDropFieldOrKey])
    50  	// ErrBlockNotLockedForWrite returns for write blocks when only hold the causet read dagger.
    51  	ErrBlockNotLockedForWrite = terror.ClassSchema.New(allegrosql.ErrBlockNotLockedForWrite, allegrosql.MyALLEGROSQLErrName[allegrosql.ErrBlockNotLockedForWrite])
    52  	// ErrBlockNotLocked returns when stochastik has explicitly dagger blocks, then visit unlocked causet will return this error.
    53  	ErrBlockNotLocked = terror.ClassSchema.New(allegrosql.ErrBlockNotLocked, allegrosql.MyALLEGROSQLErrName[allegrosql.ErrBlockNotLocked])
    54  	// ErrBlockNotExists returns for causet not exists.
    55  	ErrBlockNotExists = terror.ClassSchema.New(allegrosql.ErrNoSuchBlock, allegrosql.MyALLEGROSQLErrName[allegrosql.ErrNoSuchBlock])
    56  	// ErrKeyNotExists returns for index not exists.
    57  	ErrKeyNotExists = terror.ClassSchema.New(allegrosql.ErrKeyDoesNotExist, allegrosql.MyALLEGROSQLErrName[allegrosql.ErrKeyDoesNotExist])
    58  	// ErrCannotAddForeign returns for foreign key exists.
    59  	ErrCannotAddForeign = terror.ClassSchema.New(allegrosql.ErrCannotAddForeign, allegrosql.MyALLEGROSQLErrName[allegrosql.ErrCannotAddForeign])
    60  	// ErrForeignKeyNotMatch returns for foreign key not match.
    61  	ErrForeignKeyNotMatch = terror.ClassSchema.New(allegrosql.ErrWrongFkDef, allegrosql.MyALLEGROSQLErrName[allegrosql.ErrWrongFkDef])
    62  	// ErrIndexExists returns for index already exists.
    63  	ErrIndexExists = terror.ClassSchema.New(allegrosql.ErrDupIndex, allegrosql.MyALLEGROSQLErrName[allegrosql.ErrDupIndex])
    64  	// ErrUserDropExists returns for dropping a non-existent user.
    65  	ErrUserDropExists = terror.ClassSchema.New(allegrosql.ErrBadUser, allegrosql.MyALLEGROSQLErrName[allegrosql.ErrBadUser])
    66  	// ErrUserAlreadyExists return for creating a existent user.
    67  	ErrUserAlreadyExists = terror.ClassSchema.New(allegrosql.ErrUserAlreadyExists, allegrosql.MyALLEGROSQLErrName[allegrosql.ErrUserAlreadyExists])
    68  	// ErrBlockLocked returns when the causet was locked by other stochastik.
    69  	ErrBlockLocked = terror.ClassSchema.New(allegrosql.ErrBlockLocked, allegrosql.MyALLEGROSQLErrName[allegrosql.ErrBlockLocked])
    70  	// ErrWrongObject returns when the causet/view/sequence is not the expected object.
    71  	ErrWrongObject = terror.ClassSchema.New(allegrosql.ErrWrongObject, allegrosql.MyALLEGROSQLErrName[allegrosql.ErrWrongObject])
    72  )