- Notifications
You must be signed in to change notification settings - Fork928
fix: handle all auth API errors#3241
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Conversation
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
getUserError, | ||
checkPermissionsError, | ||
getMethodsError, | ||
}} |
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.
Nice!
Uh oh!
There was an error while loading.Please reload this page.
<ErrorSummary | ||
error={loginErrors.checkPermissionsError} | ||
defaultMessage={Language.checkPermissionsErrorMessage} | ||
/> |
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.
I would DRY this up by mapping over the keys ofloginErrors
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.
Thought about it, but we’ll have to map default messages in a separate object for that. I’ll try that!
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.
I was thinking if you map over the keys you could dodefaultMessage={Language[errorKey]}
if you name them the same
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.
Declared anenum
with error types, and used aRecord<enum, Error>
for iterating through keys. I was not able iterate through the properties of atype
orinterface
.
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.
Oh I was thinking of iterating overObject.keys(loginErrors)
.
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.
Yeah, that threw some error and I wasn't able to proceed.
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.
I had some suggestions but this is awesome!
@presleyp Might need some pairing help on this one, but since we are showing |
Ah, yes! There was some talk about whether it was correct that an error is thrown at this point, so I suggest checking with the backend team about whether they want it to throw, and if so I guess just don't show that one. But happy to pair. |
Uh oh!
There was an error while loading.Please reload this page.
Building on#3190, this PR handles all the remaining auth API errors:
getUserWill handle in a separate PRSubtasks
ErrorSummary
component.Makes more progress towards#3088. Leaves handling
getUserError
now.Screenshots
getSSHKey
regenerateSSHKey