OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2007 Apple Inc. All rights reserved. | 2 * Copyright (C) 2007 Apple Inc. All rights reserved. |
3 * Copyright (C) 2012 Google Inc. All rights reserved. | 3 * Copyright (C) 2012 Google Inc. All rights reserved. |
4 * | 4 * |
5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
6 * modification, are permitted provided that the following conditions | 6 * modification, are permitted provided that the following conditions |
7 * are met: | 7 * are met: |
8 * | 8 * |
9 * 1. Redistributions of source code must retain the above copyright | 9 * 1. Redistributions of source code must retain the above copyright |
10 * notice, this list of conditions and the following disclaimer. | 10 * notice, this list of conditions and the following disclaimer. |
(...skipping 1481 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1492 * @param {T} defaultValue | 1492 * @param {T} defaultValue |
1493 * @return {!Promise.<T>} | 1493 * @return {!Promise.<T>} |
1494 * @template T | 1494 * @template T |
1495 */ | 1495 */ |
1496 Promise.prototype.catchException = function(defaultValue) { | 1496 Promise.prototype.catchException = function(defaultValue) { |
1497 return this.catch(function (error) { | 1497 return this.catch(function (error) { |
1498 console.error(error); | 1498 console.error(error); |
1499 return defaultValue; | 1499 return defaultValue; |
1500 }); | 1500 }); |
1501 } | 1501 } |
1502 | |
1503 /** | |
1504 * @param {!Object} object | |
1505 * @param {*} propertyName | |
1506 * @param {T} result | |
1507 * @return {T} | |
1508 * @template T | |
1509 */ | |
1510 function storeResultTo(object, propertyName, result) | |
1511 { | |
1512 object[propertyName] = result; | |
1513 return result; | |
1514 } | |
OLD | NEW |