mirror of
https://github.com/angular/angular
synced 2026-05-24 09:28:37 +00:00
refactor(core): drop component factory error in production (#60601)
Drops component factory error in production. Couldn't capture it before because of `throw Error` (without `new`). PR Close #60601
This commit is contained in:
parent
accc65c2c9
commit
2fe8f1a9de
5 changed files with 18 additions and 3 deletions
|
|
@ -124,6 +124,8 @@ export const enum RuntimeErrorCode {
|
|||
// (undocumented)
|
||||
NO_BINDING_TARGET = 315,
|
||||
// (undocumented)
|
||||
NO_COMPONENT_FACTORY_FOUND = 917,
|
||||
// (undocumented)
|
||||
NO_SUPPORTING_DIFFER_FACTORY = 901,
|
||||
// (undocumented)
|
||||
OUTPUT_REF_DESTROYED = 953,
|
||||
|
|
|
|||
|
|
@ -125,6 +125,7 @@ export const enum RuntimeErrorCode {
|
|||
UNEXPECTED_ZONEJS_PRESENT_IN_ZONELESS_MODE = 914,
|
||||
MISSING_NG_MODULE_DEFINITION = 915,
|
||||
MISSING_DIRECTIVE_DEFINITION = 916,
|
||||
NO_COMPONENT_FACTORY_FOUND = 917,
|
||||
|
||||
// Signal integration errors
|
||||
REQUIRED_INPUT_NO_VALUE = -950,
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@
|
|||
* found in the LICENSE file at https://angular.dev/license
|
||||
*/
|
||||
|
||||
import {RuntimeError, RuntimeErrorCode} from '../errors';
|
||||
import {Type} from '../interface/type';
|
||||
import {stringify} from '../util/stringify';
|
||||
|
||||
|
|
@ -13,7 +14,12 @@ import type {ComponentFactory} from './component_factory';
|
|||
|
||||
class _NullComponentFactoryResolver implements ComponentFactoryResolver {
|
||||
resolveComponentFactory<T>(component: {new (...args: any[]): T}): ComponentFactory<T> {
|
||||
throw Error(`No component factory found for ${stringify(component)}.`);
|
||||
throw new RuntimeError(
|
||||
RuntimeErrorCode.NO_COMPONENT_FACTORY_FOUND,
|
||||
typeof ngDevMode !== 'undefined' &&
|
||||
ngDevMode &&
|
||||
`No component factory found for ${stringify(component)}.`,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -12,7 +12,13 @@ export function getClosureSafeProperty<T>(objWithPropertyToExtract: T): string {
|
|||
return key;
|
||||
}
|
||||
}
|
||||
throw Error('Could not find renamed property on target object.');
|
||||
// Cannot change it to `RuntimeError` because the `util` target cannot
|
||||
// circularly depend on the `core` target.
|
||||
throw Error(
|
||||
typeof ngDevMode !== 'undefined' && ngDevMode
|
||||
? 'Could not find renamed property on target object.'
|
||||
: '',
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -698,7 +698,7 @@
|
|||
"storeLViewOnDestroy",
|
||||
"storeListenerCleanup",
|
||||
"stringify",
|
||||
"stringify13",
|
||||
"stringify14",
|
||||
"stringifyCSSSelector",
|
||||
"stripTrailingSlash",
|
||||
"subscribeOn",
|
||||
|
|
|
|||
Loading…
Reference in a new issue