-
Notifications
You must be signed in to change notification settings - Fork 345
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
move error codes into their exception types [1004] #1033
Conversation
@@ -86,7 +86,7 @@ public AdfsOpenIdConfigurationEndpointManager(IServiceBundle serviceBundle) | |||
a.Href.Equals(resource, StringComparison.OrdinalIgnoreCase)) == null) | |||
{ | |||
throw MsalExceptionFactory.GetClientException( | |||
MsalError.InvalidAuthority, | |||
MsalServiceException.InvalidAuthority, |
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.
should be client here.
@@ -60,7 +60,7 @@ public AuthorityEndpointResolutionManager(IServiceBundle serviceBundle, bool sho | |||
if (authorityInfo.AuthorityType == AuthorityType.Adfs && string.IsNullOrEmpty(userPrincipalName)) | |||
{ | |||
throw MsalExceptionFactory.GetClientException( | |||
MsalError.UpnRequired, | |||
MsalServiceException.UpnRequired, |
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.
client.
@@ -82,7 +82,7 @@ public class MsalClientException : MsalException | |||
/// implementing chrome tabs is missing on the Android phone (that's only an example: this exception can apply to other | |||
/// platforms as well) | |||
/// </summary> | |||
public const string AuthenticationUiFailedError = "authentication_ui_failed"; | |||
public const string AuthenticationUiFailed = "authentication_ui_failed"; |
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.
will this be a breaking change? w/the name change?
|
||
// todo: not used anywhere |
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.
can we just remove all this?
MsalErrorMessage.NonParsableOAuthError, | ||
response); | ||
} | ||
catch (Exception ex) | ||
{ | ||
exceptionToThrow = MsalExceptionFactory.GetServiceException(MsalError.UnknownError, response.Body, response, ex); | ||
exceptionToThrow = MsalExceptionFactory.GetServiceException(MsalException.UnknownError, response.Body, response, ex); |
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.
should this be service?
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.
🐑 🐺
@mzuber@microsoft.com so i went too fast and didn't read this before reviewing. I agree. I like having |
How would this affect the DevEx @MarkZuber and @jennyf19 ? for instance, how would this transform the code in https://github.com/AzureAD/microsoft-authentication-library-for-dotnet/wiki/Username-Password-Authentication#how-to-use-it ? If we do as you propose, @MarkZuber, let's make sure that the XML comments tell customers if an error message can be thrown in a client or service exception. Finally, this discussion is also related to the Apple team's proposal: MSAL error handling in iOS. Apparently they prefer option 6. |
@@ -60,7 +60,7 @@ public static void Validate(Uri redirectUri, bool usesSystemBrowser = false) | |||
Constants.DefaultRedirectUri.Equals(redirectUri.AbsoluteUri, StringComparison.OrdinalIgnoreCase)) | |||
{ | |||
throw MsalExceptionFactory.GetClientException( |
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 might be a good moment to delete the exception factory.
So for us, option 6 would look like moving all error types into MsalError.cs which is also what I'm proposing. Splitting them into the different exceptions, i feel, looks odd in this PR. |
@MarkZuber : I'm a bit confused by this PR. |
I have two PRs.
|
Officially aborting this PR. The way we're going is this: #1039 |
Thanks for clarifying, @MarkZuber |
I've started working on [1004] for moving MsalError error constants into their respective exception classes.
Looking through the first run of this change, I'm actually not a fan of this approach. I believe we should go the other way and remove the constants from the exception class and have everything in MsalError (with corresponding messages in MsalErrorMessage)
Please comment on this feedback as well as what we should do with the errors that aren't used on any of the exceptions if you still believe we should go this way. Should they just go into MsalException (even though they'll never be attached to an exception)?
#1004