Skip to content

Commit

Permalink
Explicitly return UserCanceled error for code strings 10 and 13
Browse files Browse the repository at this point in the history
  • Loading branch information
jinchung committed Sep 10, 2024
1 parent e798c5a commit c659ecb
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions src/keychain/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -172,16 +172,20 @@ export async function get(key: string, options: KeychainOptions = {}): Promise<R
}
default: {
// Avoid logging user cancelled operations
if (!(e.toString().includes('code: 10') || e.toString().includes('code: 13'))) {
if (e.toString().includes('code: 10') || e.toString().includes('code: 13')) {
return {
value: undefined,
error: ErrorType.UserCanceled,
};
} else {
logger.error(new RainbowError(`[keychain]: _get() handled unknown error`), {
message: e.toString(),
});
return {
value: undefined,
error: ErrorType.Unknown,
};
}

return {
value: undefined,
error: ErrorType.Unknown,
};
}
}
}
Expand Down

0 comments on commit c659ecb

Please sign in to comment.