Skip to content

Commit 563929b

Browse files
committed
Improve logging
1 parent 84ccaea commit 563929b

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed

src/cli/util/config.ts

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,12 +40,16 @@ export async function loadStaticPublisherRcFile(): Promise<StaticPublishRc> {
4040
try {
4141
configRaw = (await import(pathToFileURL(configFilePath).href)).default;
4242
} catch (ex) {
43-
console.log('Unable to load ' + configFilePath, String(ex));
43+
throw new LoadConfigError(configFile, [
44+
`Unable to load ${configFilePath}`,
45+
String(ex),
46+
]);
4447
}
4548

4649
if (configRaw == null) {
4750
throw new LoadConfigError(configFile, [
48-
'Unable to load ' + configFile,
51+
`Unable to load ${configFilePath}`,
52+
`default export does not exist or is null.`
4953
]);
5054
}
5155

@@ -133,12 +137,16 @@ export async function loadPublishContentConfigFile(configFile: string): Promise<
133137
try {
134138
configRaw = (await import(pathToFileURL(configFilePath).href)).default;
135139
} catch (ex) {
136-
console.log('Unable to load ' + configFilePath, String(ex));
140+
throw new LoadConfigError(configFile, [
141+
`Unable to load ${configFilePath}`,
142+
String(ex),
143+
]);
137144
}
138145

139146
if (configRaw == null) {
140147
throw new LoadConfigError(configFile, [
141-
'Unable to load ' + configFile,
148+
`Unable to load ${configFilePath}`,
149+
`default export does not exist or is null.`
142150
]);
143151
}
144152

0 commit comments

Comments
 (0)