(
error: any,
token: ProviderToken<unknown> | {multi: true; provide: ProviderToken<unknown>},
)
| 83 | * @param token Extra token that should be appended. |
| 84 | */ |
| 85 | export function prependTokenToDependencyPath( |
| 86 | error: any, |
| 87 | token: ProviderToken<unknown> | {multi: true; provide: ProviderToken<unknown>}, |
| 88 | ): void { |
| 89 | error[NG_TOKEN_PATH] ??= []; |
| 90 | // Append current token to the current token path. Since the error |
| 91 | // is bubbling up, add the token in front of other tokens. |
| 92 | const currentPath = error[NG_TOKEN_PATH]; |
| 93 | // Do not append the same token multiple times. |
| 94 | let pathStr: string; |
| 95 | if (typeof token === 'object' && 'multi' in token && token?.multi === true) { |
| 96 | assertDefined(token.provide, 'Token with multi: true should have a provide property'); |
| 97 | pathStr = stringifyForError(token.provide); |
| 98 | } else { |
| 99 | pathStr = stringifyForError(token); |
| 100 | } |
| 101 | |
| 102 | if (currentPath[0] !== pathStr) { |
| 103 | (error[NG_TOKEN_PATH] as string[]).unshift(pathStr); |
| 104 | } |
| 105 | } |
| 106 | |
| 107 | /** |
| 108 | * Modifies an Error instance with an updated error message |
no test coverage detected
searching dependent graphs…