Skip to content

Commit ee305d2

Browse files
committed
Merge pull request #10667 from wagenet/deprecate-try-catch-finally
Deprecate tryFinally and tryCatchFinally
2 parents 8c84524 + 082e17d commit ee305d2

2 files changed

Lines changed: 19 additions & 5 deletions

File tree

packages/ember-metal/lib/main.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,8 @@ import {
3030
meta,
3131
metaPath,
3232
setMeta,
33-
tryCatchFinally,
34-
tryFinally,
33+
deprecatedTryCatchFinally,
34+
deprecatedTryFinally,
3535
tryInvoke,
3636
typeOf,
3737
uuid,
@@ -263,12 +263,12 @@ Ember.setMeta = setMeta;
263263
Ember.metaPath = metaPath;
264264
Ember.inspect = inspect;
265265
Ember.typeOf = typeOf;
266-
Ember.tryCatchFinally = tryCatchFinally;
266+
Ember.tryCatchFinally = deprecatedTryCatchFinally;
267267
Ember.isArray = isArray;
268268
Ember.makeArray = makeArray;
269269
Ember.canInvoke = canInvoke;
270270
Ember.tryInvoke = tryInvoke;
271-
Ember.tryFinally = tryFinally;
271+
Ember.tryFinally = deprecatedTryFinally;
272272
Ember.wrap = wrap;
273273
Ember.apply = apply;
274274
Ember.applyStr = applyStr;

packages/ember-metal/lib/utils.js

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -665,6 +665,7 @@ var needsFinallyFix = (function() {
665665
```
666666
667667
@method tryFinally
668+
@deprecated Use JavaScript's native try/finally
668669
@for Ember
669670
@param {Function} tryable The function to run the try callback
670671
@param {Function} finalizer The function to run the finally callback
@@ -711,6 +712,11 @@ if (needsFinallyFix) {
711712
};
712713
}
713714

715+
var deprecatedTryFinally = function() {
716+
Ember.deprecate("tryFinally is deprecated. Please use JavaScript's native try/finally.", false);
717+
return tryFinally.apply(this, arguments);
718+
};
719+
714720
/**
715721
Provides try/catch/finally functionality, while working
716722
around Safari's double finally bug.
@@ -741,6 +747,7 @@ if (needsFinallyFix) {
741747
```
742748
743749
@method tryCatchFinally
750+
@deprecated Use JavaScript's native try/catch/finally instead
744751
@for Ember
745752
@param {Function} tryable The function to run the try callback
746753
@param {Function} catchable The function to run the catchable callback
@@ -791,6 +798,11 @@ if (needsFinallyFix) {
791798
};
792799
}
793800

801+
var deprecatedTryCatchFinally = function() {
802+
Ember.deprecate("tryCatchFinally is deprecated. Please use JavaScript's native try/catch/finally.", false);
803+
return tryCatchFinally.apply(this, arguments);
804+
};
805+
794806
// ........................................
795807
// TYPING & ARRAY MESSAGING
796808
//
@@ -972,7 +984,9 @@ export {
972984
meta,
973985
typeOf,
974986
tryCatchFinally,
987+
deprecatedTryCatchFinally,
975988
isArray,
976989
canInvoke,
977-
tryFinally
990+
tryFinally,
991+
deprecatedTryFinally
978992
};

0 commit comments

Comments
 (0)