diff --git a/packages/core/src/resource/resource.ts b/packages/core/src/resource/resource.ts index e15a7116f9c..04e3bdcf858 100644 --- a/packages/core/src/resource/resource.ts +++ b/packages/core/src/resource/resource.ts @@ -30,13 +30,6 @@ import {PendingTasks} from '../pending_tasks'; import {linkedSignal} from '../render3/reactivity/linked_signal'; import {DestroyRef} from '../linker/destroy_ref'; -/** - * Whether a `Resource.value()` should throw an error when the resource is in the error state. - * - * This internal flag is being used to gradually roll out this behavior. - */ -let RESOURCE_VALUE_THROWS_ERRORS_DEFAULT = true; - /** * Constructs a `Resource` that projects a reactive request to an asynchronous operation defined by * a loader function, which exposes the result of the loading operation via signals. @@ -77,7 +70,6 @@ export function resource(options: ResourceOptions): ResourceRef extends BaseWritableResource implements Resou defaultValue: T, private readonly equal: ValueEqualityFn | undefined, injector: Injector, - throwErrorsFromValue: boolean = RESOURCE_VALUE_THROWS_ERRORS_DEFAULT, ) { super( // Feed a computed signal for the value to `BaseWritableResource`, which will upgrade it to a @@ -196,11 +187,7 @@ export class ResourceImpl extends BaseWritableResource implements Resou } if (!isResolved(streamValue)) { - if (throwErrorsFromValue) { - throw new ResourceValueError(this.error()!); - } else { - return defaultValue; - } + throw new ResourceValueError(this.error()!); } return streamValue.value;