refactor(core): inline depPath in throwCyclicDependencyError to be dropped (#60084)

Inlines the `depPath` within the `throwCyclicDependencyError`, because it's not being tree-shaken in production.

PR Close #60084
This commit is contained in:
arturovt
2025-02-24 19:44:02 +02:00
committed by kirjs
parent d85ebb4475
commit 11ab5db9bd
+3 -2
View File
@@ -16,10 +16,11 @@ import {stringifyForError} from './util/stringify_utils';
/** Called when directives inject each other (creating a circular dependency) */
export function throwCyclicDependencyError(token: string, path?: string[]): never {
const depPath = path ? `. Dependency path: ${path.join(' > ')} > ${token}` : '';
throw new RuntimeError(
RuntimeErrorCode.CYCLIC_DI_DEPENDENCY,
ngDevMode ? `Circular dependency in DI detected for ${token}${depPath}` : token,
ngDevMode
? `Circular dependency in DI detected for ${token}${path ? `. Dependency path: ${path.join(' > ')} > ${token}` : ''}`
: token,
);
}