diff --git a/packages/core/src/di/inject_switch.ts b/packages/core/src/di/inject_switch.ts index 9614aa2ec1..531481a18c 100644 --- a/packages/core/src/di/inject_switch.ts +++ b/packages/core/src/di/inject_switch.ts @@ -7,6 +7,7 @@ */ import {AbstractType, Type} from '../interface/type'; +import {throwProviderNotFoundError} from '../render3/errors_di'; import {assertNotEqual} from '../util/assert'; import {stringify} from '../util/stringify'; import {InjectionToken} from './injection_token'; @@ -62,7 +63,7 @@ export function injectRootLimpMode( } if (flags & InjectFlags.Optional) return null; if (notFoundValue !== undefined) return notFoundValue; - throw new Error(`Injector: NOT_FOUND [${stringify(token)}]`); + throwProviderNotFoundError(stringify(token), 'Injector'); } diff --git a/packages/core/test/bundling/injection/bundle.golden_symbols.json b/packages/core/test/bundling/injection/bundle.golden_symbols.json index 951bb4b9af..2333422a61 100644 --- a/packages/core/test/bundling/injection/bundle.golden_symbols.json +++ b/packages/core/test/bundling/injection/bundle.golden_symbols.json @@ -47,6 +47,9 @@ { "name": "R3Injector" }, + { + "name": "RuntimeError" + }, { "name": "ScopedService" },