| OLD | NEW |
| (Empty) | |
| 1 <!-- |
| 2 Copyright 2016 The LUCI Authors. All rights reserved. |
| 3 Use of this source code is governed under the Apache License, Version 2.0 |
| 4 that can be found in the LICENSE file. |
| 5 --> |
| 6 |
| 7 <link rel="import" href="../rpc/rpc-error.html"> |
| 8 |
| 9 <script> |
| 10 "use strict"; |
| 11 |
| 12 function LogDogError(base) { |
| 13 this.base = base; |
| 14 }; |
| 15 LogDogError.wrapGrpc = function(err) { |
| 16 if (err instanceof luci.rpc.GrpcError) { |
| 17 return new LogDogError(err); |
| 18 } |
| 19 return err; |
| 20 } |
| 21 |
| 22 LogDogError.prototype = Object.create(Error.prototype); |
| 23 LogDogError.prototype.isGrpcError = function() { |
| 24 return (this.base.name === "GrpcError"); |
| 25 }; |
| 26 LogDogError.prototype.isNotFound = function() { |
| 27 return (this.isGrpcError() && this.base.code === 5); |
| 28 }; |
| 29 LogDogError.prototype.isPermissionDenied = function() { |
| 30 return (this.isGrpcError() && this.base.code === 7); |
| 31 }; |
| 32 </script> |
| OLD | NEW |