cubefs
62 строки · 1.4 Кб
1/*
2*
3* Copyright 2017 gRPC authors.
4*
5* Licensed under the Apache License, Version 2.0 (the "License");
6* you may not use this file except in compliance with the License.
7* You may obtain a copy of the License at
8*
9* http://www.apache.org/licenses/LICENSE-2.0
10*
11* Unless required by applicable law or agreed to in writing, software
12* distributed under the License is distributed on an "AS IS" BASIS,
13* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14* See the License for the specific language governing permissions and
15* limitations under the License.
16*
17*/
18
19package codes
20
21import "strconv"
22
23func (c Code) String() string {
24switch c {
25case OK:
26return "OK"
27case Canceled:
28return "Canceled"
29case Unknown:
30return "Unknown"
31case InvalidArgument:
32return "InvalidArgument"
33case DeadlineExceeded:
34return "DeadlineExceeded"
35case NotFound:
36return "NotFound"
37case AlreadyExists:
38return "AlreadyExists"
39case PermissionDenied:
40return "PermissionDenied"
41case ResourceExhausted:
42return "ResourceExhausted"
43case FailedPrecondition:
44return "FailedPrecondition"
45case Aborted:
46return "Aborted"
47case OutOfRange:
48return "OutOfRange"
49case Unimplemented:
50return "Unimplemented"
51case Internal:
52return "Internal"
53case Unavailable:
54return "Unavailable"
55case DataLoss:
56return "DataLoss"
57case Unauthenticated:
58return "Unauthenticated"
59default:
60return "Code(" + strconv.FormatInt(int64(c), 10) + ")"
61}
62}
63