mirror of
https://github.com/BerriAI/litellm.git
synced 2026-09-16 23:41:43 +00:00
[Fix] Let setSecureItem propagate storage errors to callers
Remove the silent try/catch from setSecureItem so OAuth hooks can surface actionable "enable storage" guidance instead of a cryptic "state lost" error after the round-trip. Add a local try/catch in ChatUI where the storage write is non-critical.
This commit is contained in:
parent
4e068718c9
commit
df3ddd7a81
2 changed files with 7 additions and 7 deletions
|
|
@ -348,8 +348,12 @@ const ChatUI: React.FC<ChatUIProps> = ({
|
|||
]);
|
||||
|
||||
useEffect(() => {
|
||||
setSecureItem("apiKeySource", JSON.stringify(apiKeySource));
|
||||
setSecureItem("apiKey", apiKey);
|
||||
try {
|
||||
setSecureItem("apiKeySource", JSON.stringify(apiKeySource));
|
||||
setSecureItem("apiKey", apiKey);
|
||||
} catch {
|
||||
// Storage full or unavailable — non-critical, skip persisting.
|
||||
}
|
||||
sessionStorage.setItem("endpointType", endpointType);
|
||||
sessionStorage.setItem("selectedTags", JSON.stringify(selectedTags));
|
||||
sessionStorage.setItem("selectedVectorStores", JSON.stringify(selectedVectorStores));
|
||||
|
|
|
|||
|
|
@ -18,11 +18,7 @@ function decode(encoded: string): string {
|
|||
}
|
||||
|
||||
export function setSecureItem(key: string, value: string): void {
|
||||
try {
|
||||
window.sessionStorage.setItem(key, encode(value));
|
||||
} catch {
|
||||
// Storage full or unavailable — silently ignore.
|
||||
}
|
||||
window.sessionStorage.setItem(key, encode(value));
|
||||
}
|
||||
|
||||
export function getSecureItem(key: string): string | null {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue