From da5441e7612ddbca35f5dc7020630df1a95c15b5 Mon Sep 17 00:00:00 2001 From: Madhur Date: Sun, 29 May 2022 13:24:03 -0700 Subject: [PATCH] Fix issue #190 --- src/core/toast.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/core/toast.ts b/src/core/toast.ts index ec04865..4f408ba 100644 --- a/src/core/toast.ts +++ b/src/core/toast.ts @@ -71,7 +71,10 @@ toast.promise = ( const id = toast.loading(msgs.loading, { ...opts, ...opts?.loading }); promise - .then((p) => { + .then(async (p) => { + if (p instanceof Response && !p?.ok) { + throw Error(await p.text()); + } toast.success(resolveValue(msgs.success, p), { id, ...opts,