function always(promise, callback) {
    function safeCallback() {
        try {
            callback();
        }
        catch (err) {
            errors.onUnexpectedError(err);
        }
    }
    promise.then(function (_) { return safeCallback(); }, function (_) { return safeCallback(); });
    return Promise.resolve(promise);
}
/**
 * Returns a new promise that joins the provided promise. Upon completion of
 * the provided promise the provided function will always be called. This
 * method is comparable to a try-finally code block.
 * @param promise a promise
 * @param callback a function that will be call in the success and error case.
 */
Returns a new promise that joins the provided promise. Upon completion of
the provided promise the provided function will always be called. This
method is comparable to a try-finally code block.
@param promise a promise
@param callback a function that will be call in the success and error case.
Returns a new promise that joins the provided promise . Upon completion of the provided promise the provided function will always be called . This method is comparable to a try - finally code block . @param promise a promise @param callback a function that will be call in the success and error case .
function always(promise, callback) {
    function safeCallback() {
        try {
            callback();
        }
        catch (err) {
            errors.onUnexpectedError(err);
        }
    }
    promise.then(function (_) { return safeCallback(); }, function (_) { return safeCallback(); });
    return Promise.resolve(promise);
}
function always ( promise , callback ) { function safeCallback ( ) { try { callback ( ) ; } catch ( err ) { errors . onUnexpectedError ( err ) ; } } promise . then ( function ( _ ) { return safeCallback ( ) ; } , function ( _ ) { return safeCallback ( ) ; } ) ; return Promise . resolve ( promise ) ; }
Returns a new promise that joins the provided promise.
Returns a new promise that joins the provided promise .