fix(config): fix catch ConfigFetchError in getValue

Closes #46
This commit is contained in:
Sebastian Lange
2019-04-05 08:15:28 +02:00
committed by Jovan Krunić
parent 301f872c06
commit 161da630ea
2 changed files with 15 additions and 1 deletions

View File

@@ -66,7 +66,14 @@ export class ConfigProvider {
*/
public async getValue(attribute: keyof SCAppConfiguration) {
if (!this.initialised) {
await this.init();
try {
await this.init();
} catch (error) {
// don't throw ConfigFetchError if saved config is available
if (!(error.name === 'ConfigFetchError' && this.initialised)) {
throw error;
}
}
}
if (typeof this.config.app[attribute] !== 'undefined') {
return this.config.app[attribute];