Skip to content

Commit

Permalink
Include error message from later versions
Browse files Browse the repository at this point in the history
More informative than current message.
  • Loading branch information
onalante-msft committed Sep 28, 2021
1 parent c11bcb1 commit b4707f6
Showing 1 changed file with 7 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -56,14 +56,16 @@ await this.currentConfig.Match(
{
Events.GettingConfig();
await pullTask;

this.currentConfig.Expect<InvalidOperationException>(() => throw new InvalidOperationException(
"Could not obtain twin neither from local store nor from cloud. " +
"This happens when there is no upstream connection and this is the first EdgeHub startup, " +
"or there is no persistent store to save a previous twin configuration. " +
"EdgeHub cannot start without basic configuration stored in twin. Stopping now."));

return this.currentConfig;
});

if (!this.currentConfig.HasValue)
{
throw new InvalidOperationException("Could not initialize configuration");
}

// Start a periodic task to pull the config.
this.configUpdater = Option.Some(new PeriodicTask(() => this.PullConfig(c => c.GetConfig()), this.configUpdateFrequency, this.configUpdateFrequency, Events.Log, "Get EdgeHub config"));
Events.Initialized();
Expand Down

0 comments on commit b4707f6

Please sign in to comment.