diff --git a/plugins/todo/src/api/TodoClient.ts b/plugins/todo/src/api/TodoClient.ts index fb0c03bac6..b8caee3ee9 100644 --- a/plugins/todo/src/api/TodoClient.ts +++ b/plugins/todo/src/api/TodoClient.ts @@ -69,7 +69,7 @@ export class TodoClient implements TodoApi { error.status = res.status; try { - const json = await res.json(); + const json = await res.clone().json(); if (typeof json?.error?.message !== 'string') { throw new Error('invalid error'); } @@ -84,6 +84,9 @@ export class TodoClient implements TodoApi { } catch { error.message = `Failed to ${action}, status ${res.status}`; } + if (res.status === 404) { + error.name = 'NotFoundError'; + } } throw error;