Skip to content

Commit

Permalink
Merge pull request #10667 from wagenet/deprecate-try-catch-finally
Browse files Browse the repository at this point in the history
Deprecate tryFinally and tryCatchFinally
  • Loading branch information
rwjblue committed Mar 19, 2015
2 parents 8c84524 + 082e17d commit ee305d2
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 5 deletions.
8 changes: 4 additions & 4 deletions packages/ember-metal/lib/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ import {
meta,
metaPath,
setMeta,
tryCatchFinally,
tryFinally,
deprecatedTryCatchFinally,
deprecatedTryFinally,
tryInvoke,
typeOf,
uuid,
Expand Down Expand Up @@ -263,12 +263,12 @@ Ember.setMeta = setMeta;
Ember.metaPath = metaPath;
Ember.inspect = inspect;
Ember.typeOf = typeOf;
Ember.tryCatchFinally = tryCatchFinally;
Ember.tryCatchFinally = deprecatedTryCatchFinally;
Ember.isArray = isArray;
Ember.makeArray = makeArray;
Ember.canInvoke = canInvoke;
Ember.tryInvoke = tryInvoke;
Ember.tryFinally = tryFinally;
Ember.tryFinally = deprecatedTryFinally;
Ember.wrap = wrap;
Ember.apply = apply;
Ember.applyStr = applyStr;
Expand Down
16 changes: 15 additions & 1 deletion packages/ember-metal/lib/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -665,6 +665,7 @@ var needsFinallyFix = (function() {
```
@method tryFinally
@deprecated Use JavaScript's native try/finally
@for Ember
@param {Function} tryable The function to run the try callback
@param {Function} finalizer The function to run the finally callback
Expand Down Expand Up @@ -711,6 +712,11 @@ if (needsFinallyFix) {
};
}

var deprecatedTryFinally = function() {
Ember.deprecate("tryFinally is deprecated. Please use JavaScript's native try/finally.", false);
return tryFinally.apply(this, arguments);
};

/**
Provides try/catch/finally functionality, while working
around Safari's double finally bug.
Expand Down Expand Up @@ -741,6 +747,7 @@ if (needsFinallyFix) {
```
@method tryCatchFinally
@deprecated Use JavaScript's native try/catch/finally instead
@for Ember
@param {Function} tryable The function to run the try callback
@param {Function} catchable The function to run the catchable callback
Expand Down Expand Up @@ -791,6 +798,11 @@ if (needsFinallyFix) {
};
}

var deprecatedTryCatchFinally = function() {
Ember.deprecate("tryCatchFinally is deprecated. Please use JavaScript's native try/catch/finally.", false);
return tryCatchFinally.apply(this, arguments);
};

// ........................................
// TYPING & ARRAY MESSAGING
//
Expand Down Expand Up @@ -972,7 +984,9 @@ export {
meta,
typeOf,
tryCatchFinally,
deprecatedTryCatchFinally,
isArray,
canInvoke,
tryFinally
tryFinally,
deprecatedTryFinally
};

0 comments on commit ee305d2

Please sign in to comment.