()
| 108 | ) |
| 109 | |
| 110 | func (c Code) String() string { |
| 111 | switch c { |
| 112 | case CodeCanceled: |
| 113 | return "canceled" |
| 114 | case CodeUnknown: |
| 115 | return "unknown" |
| 116 | case CodeInvalidArgument: |
| 117 | return "invalid_argument" |
| 118 | case CodeDeadlineExceeded: |
| 119 | return "deadline_exceeded" |
| 120 | case CodeNotFound: |
| 121 | return "not_found" |
| 122 | case CodeAlreadyExists: |
| 123 | return "already_exists" |
| 124 | case CodePermissionDenied: |
| 125 | return "permission_denied" |
| 126 | case CodeResourceExhausted: |
| 127 | return "resource_exhausted" |
| 128 | case CodeFailedPrecondition: |
| 129 | return "failed_precondition" |
| 130 | case CodeAborted: |
| 131 | return "aborted" |
| 132 | case CodeOutOfRange: |
| 133 | return "out_of_range" |
| 134 | case CodeUnimplemented: |
| 135 | return "unimplemented" |
| 136 | case CodeInternal: |
| 137 | return "internal" |
| 138 | case CodeUnavailable: |
| 139 | return "unavailable" |
| 140 | case CodeDataLoss: |
| 141 | return "data_loss" |
| 142 | case CodeUnauthenticated: |
| 143 | return "unauthenticated" |
| 144 | } |
| 145 | return fmt.Sprintf("code_%d", c) |
| 146 | } |
| 147 | |
| 148 | // MarshalText implements [encoding.TextMarshaler]. |
| 149 | func (c Code) MarshalText() ([]byte, error) { |
no outgoing calls