github.com/vedadiyan/sqlparser@v1.0.0/pkg/vterrors/state.go (about) 1 /* 2 Copyright 2021 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 vterrors 18 19 import vtrpcpb "github.com/vedadiyan/sqlparser/pkg/vtrpc" 20 21 // State is error state 22 type State int 23 24 // All the error states 25 const ( 26 Undefined State = iota 27 28 // invalid argument 29 BadFieldError 30 BadTableError 31 CantUseOptionHere 32 DataOutOfRange 33 EmptyQuery 34 ForbidSchemaChange 35 IncorrectGlobalLocalVar 36 NonUniqError 37 NonUniqTable 38 NonUpdateableTable 39 SyntaxError 40 WrongFieldWithGroup 41 WrongGroupField 42 WrongTypeForVar 43 WrongValueForVar 44 LockOrActiveTransaction 45 MixOfGroupFuncAndFields 46 DupFieldName 47 WrongValueCountOnRow 48 WrongValue 49 50 // failed precondition 51 NoDB 52 InnodbReadOnly 53 WrongNumberOfColumnsInSelect 54 CantDoThisInTransaction 55 RequiresPrimaryKey 56 OperandColumns 57 58 // not found 59 BadDb 60 DbDropExists 61 NoSuchTable 62 SPDoesNotExist 63 UnknownSystemVariable 64 UnknownTable 65 NoSuchSession 66 67 // already exists 68 DbCreateExists 69 70 // resource exhausted 71 NetPacketTooLarge 72 73 // cancelled 74 QueryInterrupted 75 76 // unimplemented 77 NotSupportedYet 78 UnsupportedPS 79 80 // permission denied 81 AccessDeniedError 82 83 // server not available 84 ServerNotAvailable 85 86 // No state should be added below NumOfStates 87 NumOfStates 88 ) 89 90 // ErrorWithState is used to return the error State is such can be found 91 type ErrorWithState interface { 92 ErrorState() State 93 } 94 95 // ErrorWithCode returns the grpc code 96 type ErrorWithCode interface { 97 ErrorCode() vtrpcpb.Code 98 }