Repository navigation
fix: handle all auth API errors - #3241
Conversation
| getUserError, | ||
| checkPermissionsError, | ||
| getMethodsError, | ||
| }} |
| <ErrorSummary | ||
| error={loginErrors.checkPermissionsError} | ||
| defaultMessage={Language.checkPermissionsErrorMessage} | ||
| /> |
There was a problem hiding this comment.
I would DRY this up by mapping over the keys of loginErrors
There was a problem hiding this comment.
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.
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.
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.
Oh I was thinking of iterating over Object.keys(loginErrors).
There was a problem hiding this comment.
Yeah, that threw some error and I wasn't able to proceed.
presleyp
left a comment
There was a problem hiding this comment.
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
ErrorSummarycomponent.Makes more progress towards #3088. Leaves handling
getUserErrornow.Screenshots
getSSHKey
regenerateSSHKey