Skip to content

Commit

Permalink
feat(deprecated-error-handling-warning): add console warning when cod…
Browse files Browse the repository at this point in the history
…e sets the flag to bad mode

It will console.warn and give the call site (via stack) of where it was set to use the deprecated error handling mode
  • Loading branch information
benlesh committed Mar 16, 2018
1 parent 583cd1d commit 49be56a
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion src/internal/config.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
let _enable_super_gross_mode_that_will_cause_bad_things = false;

/**
* The global configuration object for RxJS, used to configure things
* like what Promise contructor should used to create Promises
Expand All @@ -17,5 +19,17 @@ export const config = {
* an unhandled error. DO NOT USE THIS FLAG UNLESS IT'S NEEDED TO BY TIME
* FOR MIGRATION REASONS.
*/
useDeprecatedSynchronousErrorHandling: false,
set useDeprecatedSynchronousErrorHandling(value: boolean) {
if (value) {
const error = new Error();
console.warn('DEPRECATED! RxJS was set to use deprecated synchronous error handling behavior by code at: \n' + error.stack);
} else if (_enable_super_gross_mode_that_will_cause_bad_things) {
console.log('RxJS: Back to a better error behavior. Thank you. <3');
}
_enable_super_gross_mode_that_will_cause_bad_things = value;
},

get useDeprecatedSynchronousErrorHandling() {
return _enable_super_gross_mode_that_will_cause_bad_things;
}
};

0 comments on commit 49be56a

Please sign in to comment.