Content-Length: 328604 | pFad | http://github.com/angular/angular/commit/bb955436e094711fe2ea9aaacb5ed51f1720b6ef

73 refactor(core): drop computation error messages in production · angular/angular@bb95543 · GitHub
Skip to content

Commit bb95543

Browse files
committed
refactor(core): drop computation error messages in production
Some of the error messages in `core/primitives` are already guarded with `ngDevMode`; this change guards the remaining ones.
1 parent 5f7f046 commit bb95543

File tree

3 files changed

+11
-3
lines changed

3 files changed

+11
-3
lines changed

packages/core/primitives/signals/src/computed.ts

+3-1
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,9 @@ const COMPUTED_NODE = /* @__PURE__ */ (() => {
133133
producerRecomputeValue(node: ComputedNode<unknown>): void {
134134
if (node.value === COMPUTING) {
135135
// Our computation somehow led to a cyclic read of itself.
136-
throw new Error('Detected cycle in computations.');
136+
throw new Error(
137+
typeof ngDevMode !== 'undefined' && ngDevMode ? 'Detected cycle in computations.' : '',
138+
);
137139
}
138140

139141
const oldValue = node.value;

packages/core/primitives/signals/src/linked_signal.ts

+3-1
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,9 @@ export const LINKED_SIGNAL_NODE = /* @__PURE__ */ (() => {
137137
producerRecomputeValue(node: LinkedSignalNode<unknown, unknown>): void {
138138
if (node.value === COMPUTING) {
139139
// Our computation somehow led to a cyclic read of itself.
140-
throw new Error('Detected cycle in computations.');
140+
throw new Error(
141+
typeof ngDevMode !== 'undefined' && ngDevMode ? 'Detected cycle in computations.' : '',
142+
);
141143
}
142144

143145
const oldValue = node.value;

packages/core/primitives/signals/src/watch.ts

+5-1
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,11 @@ export function createWatch(
9999
}
100100

101101
if (isInNotificationPhase()) {
102-
throw new Error(`Schedulers cannot synchronously execute watches while scheduling.`);
102+
throw new Error(
103+
typeof ngDevMode !== 'undefined' && ngDevMode
104+
? 'Schedulers cannot synchronously execute watches while scheduling.'
105+
: '',
106+
);
103107
}
104108

105109
node.dirty = false;

0 commit comments

Comments
 (0)








ApplySandwichStrip

pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

Fetched URL: http://github.com/angular/angular/commit/bb955436e094711fe2ea9aaacb5ed51f1720b6ef

Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy