Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix digital twins samples #16118

Merged
merged 3 commits into from
Oct 20, 2020
Merged

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