-
Notifications
You must be signed in to change notification settings - Fork 881
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
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!
<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 of 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.
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 do defaultMessage={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 an enum
with error types, and used a Record<enum, Error>
for iterating through keys. I was not able iterate through the properties of a type
or interface
.
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 over Object.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. |
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