Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(219)

Side by Side Diff: web/inc/logdog-stream/logdog-error.html

Issue 2543323004: Rewrite LogDog log viewer app. (Closed)
Patch Set: Control all fetch sizes, fix follow on initial click, fix small fetch when auth is retrid. Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 <!-- 1 <!--
2 Copyright 2016 The LUCI Authors. All rights reserved. 2 Copyright 2016 The LUCI Authors. All rights reserved.
3 Use of this source code is governed under the Apache License, Version 2.0 3 Use of this source code is governed under the Apache License, Version 2.0
4 that can be found in the LICENSE file. 4 that can be found in the LICENSE file.
5 --> 5 -->
6 6
7 <link rel="import" href="../rpc/rpc-error.html"> 7 <link rel="import" href="../rpc/rpc-error.html">
8 8
9 <script> 9 <script>
10 "use strict"; 10 "use strict";
11 11
12 function LogDogError(base) { 12 function LogDogError(base) {
13 this.base = base; 13 this.base = base;
14 }; 14 };
15 LogDogError.wrapGrpc = function(err) { 15 LogDogError.wrapGrpc = function(err) {
16 if (err instanceof luci.rpc.GrpcError) { 16 if (err instanceof luci.rpc.GrpcError) {
17 return new LogDogError(err); 17 return new LogDogError(err);
18 } 18 }
19 return err; 19 return err;
20 } 20 }
21 21
22 LogDogError.prototype = Object.create(Error.prototype); 22 LogDogError.prototype = Object.create(Error.prototype);
23 LogDogError.prototype.isGrpcError = function() { 23 LogDogError.prototype.isGrpcError = function() {
24 return (this.base.name === "GrpcError"); 24 return (this.base.name === "GrpcError");
25 }; 25 };
26 LogDogError.prototype.isNotFound = function() { 26 LogDogError.prototype.isNotFound = function() {
27 return (this.isGrpcError() && this.base.code === 5); 27 return (this.isGrpcError() && this.base.code === luci.rpc.Code.NOT_FOUND);
28 }; 28 };
29 LogDogError.prototype.isUnauthenticated = function() { 29 LogDogError.prototype.isUnauthenticated = function() {
30 return (this.isGrpcError() && this.base.code === 16); 30 return (this.isGrpcError() &&
31 this.base.code === luci.rpc.Code.UNAUTHENTICATED);
32 };
33 LogDogError.prototype.isTransient = function() {
34 if ( ! this.isGrpcError() ) {
35 return false;
36 }
37 switch ( this.base.code ) {
38 case luci.rpc.Code.INTERNAL:
39 case luci.rpc.Code.UNAVAILABLE:
40 case luci.rpc.Code.RESOURCE_EXHAUSTED:
41 return true;
42
43 default:
44 return false;
45 }
31 }; 46 };
32 </script> 47 </script>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698