mirror of
https://github.com/angular/angular
synced 2026-05-24 09:28:37 +00:00
refactor(core): remove duplicate stringify (#53751)
`throwProviderNotFoundError` already stringifies for error. Also let's restrain the paramter type. PR Close #53751
This commit is contained in:
parent
ce41575e34
commit
4cb4e984fb
2 changed files with 4 additions and 2 deletions
|
|
@ -59,7 +59,7 @@ export function injectRootLimpMode<T>(
|
|||
}
|
||||
if (flags & InjectFlags.Optional) return null;
|
||||
if (notFoundValue !== undefined) return notFoundValue;
|
||||
throwProviderNotFoundError(stringify(token), 'Injector');
|
||||
throwProviderNotFoundError(token, 'Injector');
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@
|
|||
* found in the LICENSE file at https://angular.io/license
|
||||
*/
|
||||
|
||||
import type {ProviderToken} from '../di';
|
||||
import {isEnvironmentProviders} from '../di/interface/provider';
|
||||
import {RuntimeError, RuntimeErrorCode} from '../errors';
|
||||
import {Type} from '../interface/type';
|
||||
|
|
@ -50,7 +51,8 @@ export function throwInvalidProviderError(
|
|||
|
||||
|
||||
/** Throws an error when a token is not found in DI. */
|
||||
export function throwProviderNotFoundError(token: any, injectorName?: string): never {
|
||||
export function throwProviderNotFoundError(
|
||||
token: ProviderToken<unknown>, injectorName?: string): never {
|
||||
const errorMessage = ngDevMode &&
|
||||
`No provider for ${stringifyForError(token)} found${
|
||||
injectorName ? ` in ${injectorName}` : ''}`;
|
||||
|
|
|
|||
Loading…
Reference in a new issue