Skip to content

Fix digital twins samples#16118

Merged
timtay-microsoft merged 3 commits intomasterfrom
feature/adt/timtay/fixSamples
Oct 20, 2020
Merged

Fix digital twins samples#16118
timtay-microsoft merged 3 commits intomasterfrom
feature/adt/timtay/fixSamples

Conversation

@timtay-microsoft
Copy link
Member

No description provided.

string sampleFloorModelId = "dtmi:com:samples:SampleFloor;1";
try
{
Console.WriteLine($"Deleting model Id '{sampleBuildingModelId}' if it exists.");
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If the sample runs once but fails to cleanup, we need to make sure that these model Ids are available to create upon any subsequent runs

Console.WriteLine($"Deleting model Id '{sampleBuildingModelId}' if it exists.");
await client.DeleteModelAsync(sampleBuildingModelId);
}
catch (Exception ex)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't need ex if unused.

// Model did not exist yet, and that's fine
}

try
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you think this would read better if this try/catch block was a helper method?

It seems to me it isn't central to the reading of the sample, but more about smooth operation of a sample.

@timtay-microsoft timtay-microsoft merged commit 2fb34e0 into master Oct 20, 2020
@timtay-microsoft timtay-microsoft deleted the feature/adt/timtay/fixSamples branch October 20, 2020 19:54
annelo-msft pushed a commit to annelo-msft/azure-sdk-for-net that referenced this pull request Feb 17, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants