-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy patherrors_gen.go
More file actions
47 lines (39 loc) · 1.59 KB
/
errors_gen.go
File metadata and controls
47 lines (39 loc) · 1.59 KB
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
// Code generated by rescodegen. DO NOT EDIT.
package main
import (
"github.com/restayway/rescode"
"google.golang.org/grpc/codes"
)
// Error code constants
const (
UserNotFoundCode uint64 = 1001
UserNotFoundHTTP int = 404
UserNotFoundGRPC codes.Code = 5
UserNotFoundMsg string = "User not found"
UserNotFoundDesc string = "The specified user could not be found in the database"
InvalidEmailCode uint64 = 1002
InvalidEmailHTTP int = 400
InvalidEmailGRPC codes.Code = 3
InvalidEmailMsg string = "Invalid email address"
InvalidEmailDesc string = "The provided email address is not valid"
DatabaseErrorCode uint64 = 1003
DatabaseErrorHTTP int = 500
DatabaseErrorGRPC codes.Code = 13
DatabaseErrorMsg string = "Database connection failed"
DatabaseErrorDesc string = "Failed to connect to the database server"
)
// UserNotFound creates a new UserNotFound error.
// The specified user could not be found in the database
func UserNotFound(err ...error) *rescode.RC {
return rescode.New(UserNotFoundCode, UserNotFoundHTTP, UserNotFoundGRPC, UserNotFoundMsg)(err...)
}
// InvalidEmail creates a new InvalidEmail error.
// The provided email address is not valid
func InvalidEmail(err ...error) *rescode.RC {
return rescode.New(InvalidEmailCode, InvalidEmailHTTP, InvalidEmailGRPC, InvalidEmailMsg)(err...)
}
// DatabaseError creates a new DatabaseError error.
// Failed to connect to the database server
func DatabaseError(err ...error) *rescode.RC {
return rescode.New(DatabaseErrorCode, DatabaseErrorHTTP, DatabaseErrorGRPC, DatabaseErrorMsg)(err...)
}