Skip to content

Commit 82d46d1

Browse files
committed
Fix new error handling in passkey-list
1 parent 047a34e commit 82d46d1

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

packages/connect-react/src/components/passkeyList/PasskeyListScreen.tsx

+8-8
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ const PasskeyListScreen = () => {
9696

9797
const deletePasskeyRes = await getConnectService().manageDelete(deleteToken, credentialsId);
9898
if (deletePasskeyRes.err) {
99-
return handleSituation(PasskeyListSituationCode.CboApiNotAvailableDuringDelete);
99+
return handleSituation(PasskeyListSituationCode.CboApiNotAvailableDuringDelete, deletePasskeyRes.val);
100100
}
101101

102102
await getPasskeyList(config, true);
@@ -120,7 +120,7 @@ const PasskeyListScreen = () => {
120120
const loadedMs = Date.now();
121121
const startAppendRes = await getConnectService().startAppend(appendToken, loadedMs, undefined, true);
122122
if (startAppendRes.err) {
123-
return handleSituation(PasskeyListSituationCode.CboApiNotAvailablePreAuthenticator);
123+
return handleSituation(PasskeyListSituationCode.CboApiNotAvailablePreAuthenticator, startAppendRes.val);
124124
}
125125

126126
if (!startAppendRes.val.attestationOptions) {
@@ -133,15 +133,15 @@ const PasskeyListScreen = () => {
133133

134134
const res = await getConnectService().completeAppend(startAppendRes.val.attestationOptions);
135135
if (res.err) {
136-
if (res.val instanceof PasskeyChallengeCancelledError) {
137-
return handleSituation(PasskeyListSituationCode.ClientPasskeyOperationCancelled);
136+
if (res.val.type === ConnectErrorType.Cancel) {
137+
return handleSituation(PasskeyListSituationCode.ClientPasskeyOperationCancelled, res.val);
138138
}
139139

140-
if (res.val instanceof ExcludeCredentialsMatchError) {
141-
return handleSituation(PasskeyListSituationCode.ClientExcludeCredentialsMatch);
140+
if (res.val.type === ConnectErrorType.ExcludeCredentialsMatch) {
141+
return handleSituation(PasskeyListSituationCode.ClientExcludeCredentialsMatch, res.val);
142142
}
143143

144-
return handleSituation(PasskeyListSituationCode.CboApiNotAvailablePostAuthenticator);
144+
return handleSituation(PasskeyListSituationCode.CboApiNotAvailablePostAuthenticator, res.val);
145145
}
146146

147147
log.debug('get passkey list');
@@ -164,7 +164,7 @@ const PasskeyListScreen = () => {
164164

165165
const passkeyList = await getConnectService().manageList(listTokenRes, triggerSignalAllAccepted);
166166
if (passkeyList.err) {
167-
return handleSituation(PasskeyListSituationCode.CboApiNotAvailableDuringInitialLoad);
167+
return handleSituation(PasskeyListSituationCode.CboApiNotAvailableDuringInitialLoad, passkeyList.val);
168168
}
169169

170170
console.log('passkeyList', passkeyList.val.passkeys);

0 commit comments

Comments
 (0)