Skip to content

Commit 49be56a

Browse files
committed
feat(deprecated-error-handling-warning): add console warning when code 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
1 parent 583cd1d commit 49be56a

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

src/internal/config.ts

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
let _enable_super_gross_mode_that_will_cause_bad_things = false;
2+
13
/**
24
* The global configuration object for RxJS, used to configure things
35
* like what Promise contructor should used to create Promises
@@ -17,5 +19,17 @@ export const config = {
1719
* an unhandled error. DO NOT USE THIS FLAG UNLESS IT'S NEEDED TO BY TIME
1820
* FOR MIGRATION REASONS.
1921
*/
20-
useDeprecatedSynchronousErrorHandling: false,
22+
set useDeprecatedSynchronousErrorHandling(value: boolean) {
23+
if (value) {
24+
const error = new Error();
25+
console.warn('DEPRECATED! RxJS was set to use deprecated synchronous error handling behavior by code at: \n' + error.stack);
26+
} else if (_enable_super_gross_mode_that_will_cause_bad_things) {
27+
console.log('RxJS: Back to a better error behavior. Thank you. <3');
28+
}
29+
_enable_super_gross_mode_that_will_cause_bad_things = value;
30+
},
31+
32+
get useDeprecatedSynchronousErrorHandling() {
33+
return _enable_super_gross_mode_that_will_cause_bad_things;
34+
}
2135
};

0 commit comments

Comments
 (0)