put a message in container node when config file is not found
This commit is contained in:
parent
0e46aed0df
commit
1555b0f4bc
1 changed files with 25 additions and 15 deletions
|
@ -169,12 +169,18 @@ export class Platform {
|
|||
}
|
||||
|
||||
async init() {
|
||||
try {
|
||||
await this.logger.run("Platform init", async (log) => {
|
||||
if (!this._config) {
|
||||
if (!this._configURL) {
|
||||
throw new Error("Neither config nor configURL was provided!");
|
||||
}
|
||||
const {body}= await this.request(this._configURL, {method: "GET", format: "json", cache: true}).response();
|
||||
const {status, body}= await this.request(this._configURL, {method: "GET", format: "json", cache: true}).response();
|
||||
if (status === 404) {
|
||||
throw new Error(`Could not find ${this._configURL}. Did you copy over config.sample.json?`);
|
||||
} else if (status >= 400) {
|
||||
throw new Error(`Got status ${status} while trying to fetch ${this._configURL}`);
|
||||
}
|
||||
this._config = body;
|
||||
}
|
||||
this.notificationService = new NotificationService(
|
||||
|
@ -185,6 +191,10 @@ export class Platform {
|
|||
await this._themeLoader?.init(manifests);
|
||||
this._themeLoader?.setTheme(await this._themeLoader.getActiveTheme(), log);
|
||||
});
|
||||
} catch (err) {
|
||||
this._container.innerText = err.message;
|
||||
throw err;
|
||||
}
|
||||
}
|
||||
|
||||
_createLogger(isDevelopment) {
|
||||
|
|
Reference in a new issue