-
Notifications
You must be signed in to change notification settings - Fork 225
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
Catch exception precisely, and change an api url #3278
base: master
Are you sure you want to change the base?
Conversation
SummarySummary
CoverageNo assemblies have been covered. |
SummarySummary
CoverageNo assemblies have been covered. |
); | ||
ViewData["name"] = user.DisplayName; | ||
} | ||
catch (Exception) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
actually no, you should not do that. as there is an attribute to catch the exception.
Did you see the [AuthorizeForScopes(Scopes = new[] { "user.read" })]
attribute, @rayluo ?
See Managing incremental consent and conditional access for details
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is true that the sample still works as-is without this part of change.
The reason I made this change is because I ran into an exception in await _graphServiceClient.Me.GetAsync(...)
after I experimentally changed the "BaseUrl" in appsettings.json from https://graph.microsoft.com/beta
to https://graph.microsoft.com/v1.0/me
. Presumably the _graphServiceClient.Me.GetAsync(...)
is only expected to work with that preconfigured MS Graph beta endpoint. In any case, this change shall make the sample more robust.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
blocking due to JM's comment
@rayluo : let's start to raise a GitHub issue with the customer problem (and repro steps)? |
{PR title}
Summary of the changes (Less than 80 chars):
Before this change, the
ViewData["json"]
was not populated.