-
Notifications
You must be signed in to change notification settings - Fork 1
/
err.go
140 lines (99 loc) · 2.64 KB
/
err.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
// Copyright (c) 2023, donnie <donnie4w@gmail.com>
// All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
//
// github.com/donnie4w/tldb
package sys
import (
"errors"
"fmt"
. "github.com/donnie4w/tldb/container"
)
type ErrCodeType int16
// file not exist
var ERR_FILENOTEXIST ErrCodeType = 201
// undefined
var ERR_UNDEFINED ErrCodeType = 500
// no run stat
var ERR_NO_RUNSTAT ErrCodeType = 501
// no clus stat
var ERR_NO_CLUSTER ErrCodeType = 502
// incr seq error
var ERR_INCR_SEQ ErrCodeType = 503
// node not find
var ERR_NODE_NOFOUND ErrCodeType = 504
// the cluster nodes do not match
var ERR_CLUS_NOMATCH ErrCodeType = 505
// over time
var ERR_TIMEOUT ErrCodeType = 506
// batch fail
var ERR_BATCHFAIL ErrCodeType = 512
// repetition send
var ERR_RESEND ErrCodeType = 513
// tx is over
var ERR_TXOVER ErrCodeType = 514
// uuid re use
var ERR_UUID_REUSE ErrCodeType = 515
// sync data error
var ERR_SYNCDATA ErrCodeType = 516
// get data error
var ERR_GETDATA ErrCodeType = 517
// broadcast error
var ERR_BROADCAST ErrCodeType = 518
// re set stat failed
var ERR_SETSTAT ErrCodeType = 519
var ERR_PROXY ErrCodeType = 520
// Disallowed operation
var ERR_EPERM ErrCodeType = 521
// load log error
var ERR_LOADLOG ErrCodeType = 522
/*********************************************/
// the input parameters are incorrect
var ERR_NO_MATCH_PARAM ErrCodeType = 401
// table field error
var ERR_TABLE_FEILD_EXIST ErrCodeType = 408
// table exist
var ERR_TABLE_EXIST ErrCodeType = 409
// data no exist
var ERR_DATA_NOEXIST ErrCodeType = 410
// table not exist
var ERR_TABLE_NOEXIST ErrCodeType = 411
// column not exist
var ERR_COLUMN_NOEXIST ErrCodeType = 412
// index not exist
var ERR_IDX_NOEXIST ErrCodeType = 413
// select over time
var ERR_TIMEOUT_1 ErrCodeType = 414
// update over time
var ERR_TIMEOUT_2 ErrCodeType = 415
// insert over time
var ERR_TIMEOUT_3 ErrCodeType = 416
// create over time
var ERR_TIMEOUT_4 ErrCodeType = 417
// truncate over time
var ERR_TIMEOUT_5 ErrCodeType = 418
// column type error
var ERR_COLUMNTYPE ErrCodeType = 419
/*********************************************/
var ERR_AUTH_NOPASS ErrCodeType = 1301
/*********************************************/
type Exception struct {
Code ErrCodeType
m *Map[int64, int8]
}
func NewException() *Exception {
return &Exception{m: NewMap[int64, int8]()}
}
func (this *Exception) Error() (err error) {
if this.Code > 0 {
err = errors.New(fmt.Sprint(this.Code))
}
return
}
func (this *Exception) Put(uuid int64) {
this.m.Put(uuid, 0)
}
func (this *Exception) Map() *Map[int64, int8] {
return this.m
}