refactor(ivy): improve error message in `ngtsc`'s `findExportedNameOfNode()` (#28963)
PR Close #28963
This commit is contained in:
parent
4525619a73
commit
a8d84660e5
|
@ -54,8 +54,8 @@ export interface ReferenceEmitStrategy {
|
||||||
/**
|
/**
|
||||||
* Generates `Expression`s which refer to `Reference`s in a given context.
|
* Generates `Expression`s which refer to `Reference`s in a given context.
|
||||||
*
|
*
|
||||||
* A `ReferenceEmitter` uses one or more `ReferenceEmitStrategy` implementations to produce a
|
* A `ReferenceEmitter` uses one or more `ReferenceEmitStrategy` implementations to produce an
|
||||||
* an `Expression` which refers to a `Reference` in the context of a particular file.
|
* `Expression` which refers to a `Reference` in the context of a particular file.
|
||||||
*/
|
*/
|
||||||
export class ReferenceEmitter {
|
export class ReferenceEmitter {
|
||||||
constructor(private strategies: ReferenceEmitStrategy[]) {}
|
constructor(private strategies: ReferenceEmitStrategy[]) {}
|
||||||
|
|
|
@ -23,9 +23,10 @@ export function findExportedNameOfNode(
|
||||||
// Look for the export which declares the node.
|
// Look for the export which declares the node.
|
||||||
const found = exports.find(sym => symbolDeclaresNode(sym, target, checker));
|
const found = exports.find(sym => symbolDeclaresNode(sym, target, checker));
|
||||||
if (found === undefined) {
|
if (found === undefined) {
|
||||||
throw new Error(`failed to find target in ${file.fileName}`);
|
throw new Error(
|
||||||
|
`Failed to find exported name of node (${target.getText()}) in '${file.fileName}'.`);
|
||||||
}
|
}
|
||||||
return found !== undefined ? found.name : null;
|
return found.name;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in New Issue