Skip to content

Commit 285f1b8

Browse files
committed
refactor(@ngtools/webpack): use template literals for error messages
Simplify multi-line string concatenation into single template literals for improved readability.
1 parent 3aa479a commit 285f1b8

File tree

1 file changed

+3
-10
lines changed

1 file changed

+3
-10
lines changed

packages/ngtools/webpack/src/transformers/replace_resources.ts

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -171,9 +171,7 @@ function visitComponentMetadata(
171171
const { line } = sourceFile.getLineAndCharacterOfPosition(node.initializer.getStart());
172172

173173
throw new Error(
174-
`Component '${className}' in '${sourceFile.fileName}' contains a non-string literal` +
175-
` 'templateUrl' value at line ${line + 1}. The 'templateUrl' property must be a` +
176-
` string literal. Expressions, variables, or other dynamic values are not supported.`,
174+
`Component '${className}' in '${sourceFile.fileName}' contains a non-string literal 'templateUrl' value at line ${line + 1}. The 'templateUrl' property must be a string literal. Expressions, variables, or other dynamic values are not supported.`,
177175
);
178176
}
179177

@@ -219,10 +217,7 @@ function visitComponentMetadata(
219217
const { line } = sourceFile.getLineAndCharacterOfPosition(element.getStart());
220218

221219
throw new Error(
222-
`Component '${className}' in '${sourceFile.fileName}' contains a non-string` +
223-
` literal '${name}' value at line ${line + 1}. The '${name}' property must` +
224-
` contain string literals. Expressions, variables, or other dynamic values` +
225-
` are not supported.`,
220+
`Component '${className}' in '${sourceFile.fileName}' contains a non-string literal '${name}' value at line ${line + 1}. The '${name}' property must contain string literals. Expressions, variables, or other dynamic values are not supported.`,
226221
);
227222
}
228223
}
@@ -243,9 +238,7 @@ function visitComponentMetadata(
243238
const { line } = sourceFile.getLineAndCharacterOfPosition(node.initializer.getStart());
244239

245240
throw new Error(
246-
`Component '${className}' in '${sourceFile.fileName}' contains a non-string literal` +
247-
` '${name}' value at line ${line + 1}. The '${name}' property must be a` +
248-
` string literal. Expressions, variables, or other dynamic values are not supported.`,
241+
`Component '${className}' in '${sourceFile.fileName}' contains a non-string literal '${name}' value at line ${line + 1}. The '${name}' property must be a string literal. Expressions, variables, or other dynamic values are not supported.`,
249242
);
250243
} else {
251244
return node;

0 commit comments

Comments
 (0)