Skip to content

Error Codes - make error details more transparent to users of jwt-auth #53

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

Merged
merged 1 commit into from
Apr 23, 2021
Merged

Error Codes - make error details more transparent to users of jwt-auth #53

merged 1 commit into from
Apr 23, 2021

Conversation

brenthosie
Copy link
Member

Description

When #52 was merged, it contains code that swallows helpful information from IMS for the thrown error. Bubble those details back up.

Related Issue

#52, #11, #9

Motivation and Context

Better messaging for users of jwt-auth for by the token exchange isn't working

How Has This Been Tested?

npm test

Screenshots (if appropriate):

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

  • I have signed the Adobe Open Source CLA.
  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have read the CONTRIBUTING document.
  • I have added tests to cover my changes.
  • All new and existing tests passed.

} else {
throwRequestFailedError(res.statusText);
}
return res.json().then(data => {
Copy link
Member Author

Choose a reason for hiding this comment

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

I think it's desirable to let res.json throw if there's something wrong, This gives us a stack trace and insight that there was something wrong doing the exchange. In this scenario, we would already have made the roundtrip, so let's figure out why it blew up.

Allows transparent error details to bubble back to the caller of auth().
if (res.ok) {
return res.json();
} else {
throwRequestFailedError(res.statusText);
Copy link
Member Author

Choose a reason for hiding this comment

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

delete the throwRequestFailedError here and let the details emerge near lines 123-130

@brenthosie brenthosie changed the title Error Codes (#52) Error Codes - make error details more transparent to users of jwt-auth Apr 23, 2021
@macdonst macdonst merged commit 28f115b into adobe:master Apr 23, 2021
@brenthosie brenthosie mentioned this pull request Apr 23, 2021
10 tasks
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