diff --git a/storage.js b/storage.js index c26942b..a2c8c6b 100644 --- a/storage.js +++ b/storage.js @@ -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}`);