OLD | NEW |
(Empty) | |
| 1 <!-- |
| 2 Copyright 2016 The Chromium Authors. All rights reserved. |
| 3 Use of this source code is governed by a BSD-style license that can be |
| 4 found in the LICENSE file. |
| 5 --> |
| 6 |
| 7 <script> |
| 8 'use strict'; |
| 9 |
| 10 var luci = (function(luci) { |
| 11 |
| 12 var rpc = luci.rpc = luci.rpc || {}; |
| 13 |
| 14 /** |
| 15 * gRPC response codes. |
| 16 * based on https://github.com/grpc/grpc-go/blob/972dbd2/codes/codes.go#L43 |
| 17 * @enum {number} |
| 18 */ |
| 19 rpc.Code = { |
| 20 OK: 0, |
| 21 CANCELED: 1, |
| 22 UNKNOWN: 2, |
| 23 INVALID_ARGUMENT: 3, |
| 24 DEADLINE_EXCEEDED: 4, |
| 25 NOT_FOUND: 5, |
| 26 ALREADY_EXISTS: 6, |
| 27 PERMISSION_DENIED: 7, |
| 28 UNAUTHENTICATED: 16, |
| 29 RESOURCE_EXHAUSTED: 8, |
| 30 FAILED_PRECONDITION: 9, |
| 31 ABORTED: 10, |
| 32 OUT_OF_RANGE: 11, |
| 33 UNIMPLEMENTED: 12, |
| 34 INTERNAL: 13, |
| 35 UNAVAILABLE: 14, |
| 36 DATA_LOSS: 15 |
| 37 }; |
| 38 |
| 39 var codeNames = {}; |
| 40 for (var name in rpc.Code) { |
| 41 codeNames[rpc.Code[name]] = name; |
| 42 } |
| 43 |
| 44 /** |
| 45 * Returns response code name or undefined. |
| 46 */ |
| 47 rpc.CodeName = function(code) { |
| 48 return codeNames[code]; |
| 49 }; |
| 50 |
| 51 return luci; |
| 52 }(luci || {})); |
| 53 </script> |
OLD | NEW |