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

WPJ related error codes #2486

Open
wants to merge 3 commits into
base: dev
Choose a base branch
from

Conversation

melissaahn
Copy link
Contributor

@melissaahn melissaahn commented Aug 26, 2024

Summary

This PR creates new error codes to help reclassify some ClientExceptions thrown in WPJ related code: https://github.com/AzureAD/ad-accounts-for-android/pull/2921

@melissaahn melissaahn added the No-Changelog This Pull-Request has no associated changelog entry. label Aug 26, 2024
@melissaahn melissaahn marked this pull request as ready for review August 26, 2024 22:19
@melissaahn melissaahn requested a review from a team as a code owner August 26, 2024 22:19
Comment on lines +432 to +445
/**
* An error occurred related to device registration.
*/
public static final String WORKPLACE_JOIN_DEVICE_REGISTRATION_ERROR = "workplace_join_device_registration_error";

/**
* An error occurred related to device attribute patching.
*/
public static final String WORKPLACE_JOIN_DEVICE_ATTRIBUTE_PATCHING_ERROR = "workplace_join_device_attribute_patching_error";

/**
* An error occurred related to getting device state.
*/
public static final String WORKPLACE_JOIN_DEVICE_STATE_ERROR = "workplace_join_device_state_error";
Copy link
Contributor

Choose a reason for hiding this comment

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

These seem to generic. They just seem to indicate that something went wrong but don't tell exactly what went wrong. Will these be actionable?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

One of these (WORKPLACE_JOIN_DEVICE_REGISTRATION_ERROR) is involved with the direct catching of a WorkplaceJoinException which was in a sort of catch-all block. Further figuring out why this WorkplaceJoinException is being thrown is possible if there's already a throwable attached to it (we could maybe run the ExceptionAdapter on it?), so let me know if that's preferable....
Other cases involve replacing instances where catch blocks create ClientException with UNKNOWN_ERROR directly for unmodeled errors. My understanding of the intention of this was to not lose the location where the original exception gets caught (I think in telemetry, the "location" is where the ClientException got created, and the cause location is where the throwable exception got created). By using the ExceptionAdapter method, I think that "location" value becomes somewhat useless, since it'll lead back to ExceptionAdapter.
I was thinking that since we were considering turning WPJExceptions into a BaseException, which means WPJ might be a big enough feature to warrant throwing the exception directly, it might be helpful to keep that location information. I could be wrong though.
I also understand that it could be weird to have instances of ClientExceptions with a null pointer error code, and others with a wpj error code but a NPE attached.

Copy link
Contributor

Choose a reason for hiding this comment

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

In general, it would be good to be able to distinguish one particular WORKPLACE_JOIN_DEVICE_REGISTRATION_ERROR vs another. It can be done by either having a different location/cause or a different error code altogether. I think if there are very few instances then cause will suffice but if there are lots of different instances then we may consider having dedicated errors codes to track these. I think for now what you've done is fine and we should iterate again based on learnings we get from telemetry once this ships.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
No-Changelog This Pull-Request has no associated changelog entry.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants