Update storage.js via upload script - 2026-10-21 11:33:44
This commit is contained in:
parent
a383e548d0
commit
ab707c5ece
|
|
@ -8,7 +8,9 @@ const API_BASE = '/api/storage';
|
|||
export async function storageGet(key) {
|
||||
const res = await fetch(`${API_BASE}/${encodeURIComponent(key)}`);
|
||||
if (res.status === 404) {
|
||||
throw new Error(`key not found: ${key}`);
|
||||
const e = new Error(`key not found: ${key}`);
|
||||
e.notFound = true; // 这个键还没存过数据(正常情况),和"读取失败"区分开
|
||||
throw e;
|
||||
}
|
||||
if (!res.ok) {
|
||||
throw new Error(`storage get failed: ${res.status}`);
|
||||
|
|
|
|||
Loading…
Reference in New Issue