blob: 0b206a57822afa3ab5e552caafdd71688cce6e11 [file] [log] [blame]
Prince Pereirac1c21d62021-04-22 08:38:15 +00001/*
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 {
24 switch c {
25 case OK:
26 return "OK"
27 case Canceled:
28 return "Canceled"
29 case Unknown:
30 return "Unknown"
31 case InvalidArgument:
32 return "InvalidArgument"
33 case DeadlineExceeded:
34 return "DeadlineExceeded"
35 case NotFound:
36 return "NotFound"
37 case AlreadyExists:
38 return "AlreadyExists"
39 case PermissionDenied:
40 return "PermissionDenied"
41 case ResourceExhausted:
42 return "ResourceExhausted"
43 case FailedPrecondition:
44 return "FailedPrecondition"
45 case Aborted:
46 return "Aborted"
47 case OutOfRange:
48 return "OutOfRange"
49 case Unimplemented:
50 return "Unimplemented"
51 case Internal:
52 return "Internal"
53 case Unavailable:
54 return "Unavailable"
55 case DataLoss:
56 return "DataLoss"
57 case Unauthenticated:
58 return "Unauthenticated"
59 default:
60 return "Code(" + strconv.FormatInt(int64(c), 10) + ")"
61 }
62}