Parcourir la source

fix: improve error handling in useSWRxLsx by throwing complete error response

Shun Miyazawa il y a 9 mois
Parent
commit
66d9396894
1 fichiers modifiés avec 2 ajouts et 2 suppressions
  1. 2 2
      packages/remark-lsx/src/client/stores/lsx/lsx.ts

+ 2 - 2
packages/remark-lsx/src/client/stores/lsx/lsx.ts

@@ -77,9 +77,9 @@ export const useSWRxLsx = (
         return res.data;
         return res.data;
       } catch (err) {
       } catch (err) {
         if (axios.isAxiosError(err)) {
         if (axios.isAxiosError(err)) {
-          throw new Error(err.response?.data.message);
+          throw new Error(err.response?.data);
         }
         }
-        throw err;
+        throw new Error(err);
       }
       }
     },
     },