Chromium Code Reviews| 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 | |
| 8 <script> | |
| 9 'use strict'; | |
| 10 | |
| 11 var rpcExplorer = (function(rpcExplorer) { | |
| 12 | |
| 13 // Based on https://github.com/grpc/grpc-go/blob/972dbd2/codes/codes.go#L43 | |
| 14 rpcExplorer.Codes = { | |
|
Bons
2016/02/13 17:18:25
JS enum naming convention is typically
rpcExplore
nodir
2016/02/17 02:02:12
Done.
| |
| 15 OK: 0, | |
| 16 Canceled: 1, | |
| 17 Unknown: 2, | |
| 18 InvalidArgument: 3, | |
| 19 DeadlineExceeded: 4, | |
| 20 NotFound: 5, | |
| 21 AlreadyExists: 6, | |
| 22 PermissionDenied: 7, | |
| 23 Unauthenticated: 16, | |
| 24 ResourceExhausted: 8, | |
| 25 FailedPrecondition: 9, | |
| 26 Aborted: 10, | |
| 27 OutOfRange: 11, | |
| 28 Unimplemented: 12, | |
| 29 Internal: 13, | |
| 30 Unavailable: 14, | |
| 31 DataLoss: 15 | |
| 32 }; | |
| 33 | |
| 34 var codeNames = {}; | |
| 35 for (var name in rpcExplorer.Codes) { | |
| 36 codeNames[rpcExplorer.Codes[name]] = name; | |
| 37 } | |
| 38 rpcExplorer.CodeName = function(code) { | |
| 39 return codeNames[code]; | |
| 40 }; | |
| 41 | |
| 42 return rpcExplorer; | |
| 43 }(rpcExplorer || {})); | |
| 44 </script> | |
| OLD | NEW |