refactor(core): use RuntimeError to throw provider not found error (#40901)
This PR performs a small refactoring to use `RuntimeError` class and corresponding error code (by calling `throwProviderNotFoundError` which formats the message) to make it more consistent with other places where similar errors are thrown. PR Close #40901
This commit is contained in:
		
							parent
							
								
									f340a5b9f2
								
							
						
					
					
						commit
						d1d1dadb41
					
				| @ -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<T>( | ||||
|   } | ||||
|   if (flags & InjectFlags.Optional) return null; | ||||
|   if (notFoundValue !== undefined) return notFoundValue; | ||||
|   throw new Error(`Injector: NOT_FOUND [${stringify(token)}]`); | ||||
|   throwProviderNotFoundError(stringify(token), 'Injector'); | ||||
| } | ||||
| 
 | ||||
| 
 | ||||
|  | ||||
| @ -47,6 +47,9 @@ | ||||
|   { | ||||
|     "name": "R3Injector" | ||||
|   }, | ||||
|   { | ||||
|     "name": "RuntimeError" | ||||
|   }, | ||||
|   { | ||||
|     "name": "ScopedService" | ||||
|   }, | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user