Skip to content

Conversation

@brentschmaltz
Copy link
Contributor

@brentschmaltz brentschmaltz commented Aug 30, 2024

The enums that map to an Exception to create have been removed. This creates a dependency in the code, benchmarks show very little change.

Reverted change related to LastKnownGood in that modified the release call graph.
Introduced a model for a derived ExceptionDetail coordinated with an additional ctor for Exceptions.

Reverted change related to LastKnownGood.
@brentschmaltz brentschmaltz requested a review from a team as a code owner August 30, 2024 18:03
Copy link
Contributor

@FuPingFranco FuPingFranco left a comment

Choose a reason for hiding this comment

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

LGTM

}

if (TokenUtilities.IsRecoverableErrorType(result.UnwrapError().Type))
if (TokenUtilities.IsRecoverableException(result.UnwrapError().GetException()))
Copy link
Contributor

Choose a reason for hiding this comment

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

Why are we allocating the exception when we could simply check the type and save the allocation?

validationParameters.RefreshBeforeValidation = false;
validationParameters.ValidateWithLKG = true;
ExceptionType recoverableExceptionType = result.UnwrapError().Type;
Exception recoverableExceptionType = result.UnwrapError().GetException();
Copy link
Contributor

Choose a reason for hiding this comment

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

Same question around allocating the exception.

/// </summary>
/// <returns>An instantance of an Exception.</returns>
public Exception GetException()
public virtual Exception GetException()
Copy link
Contributor

Choose a reason for hiding this comment

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

The Activator used in this PR: #2800, is more extensible than this approach. Why are we resorting to still using a bunch of ifs checking for the different exceptions?

One more thing to consider is that the ArgumentNullException not inheriting from SecurityTokenException and therefore doesn't have a stack trace.

@iNinja
Copy link
Contributor

iNinja commented Sep 3, 2024

This PR is re-doing the work done in a previous PR, #2800.

I am not seeing the point on merging these changes over the linked PR. I am happy to take the approach to initialise exceptions with the ExceptionDetail presented here onto that one.

@brentschmaltz
Copy link
Contributor Author

Added changes to #2801.

Will pull in additional work around adding ExceptionDetails to SecurityTokenException.

@brentschmaltz brentschmaltz deleted the brentsch/ExceptionDetail branch October 23, 2024 21:55
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.

5 participants