mirror of
https://github.com/pezkuwichain/pezkuwi-telegram-miniapp.git
synced 2026-04-22 01:57:56 +00:00
fix: extract actual error from Edge Function response
This commit is contained in:
+1
-1
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "pezkuwi-telegram-miniapp",
|
||||
"version": "1.0.153",
|
||||
"version": "1.0.155",
|
||||
"type": "module",
|
||||
"description": "Pezkuwichain Telegram Mini App - Forum, Announcements, Rewards",
|
||||
"author": "Pezkuwichain Team",
|
||||
|
||||
@@ -164,8 +164,17 @@ export function useAnnouncementReaction() {
|
||||
});
|
||||
|
||||
if (error) {
|
||||
console.error('[useAnnouncementReaction] Edge function error:', error);
|
||||
throw new Error(error.message || 'Failed to process reaction');
|
||||
let msg = error.message || 'Failed';
|
||||
try {
|
||||
const body = error.context?.body;
|
||||
if (body) {
|
||||
const parsed = JSON.parse(body);
|
||||
if (parsed.error) msg = parsed.error;
|
||||
}
|
||||
} catch {
|
||||
// ignore parse errors
|
||||
}
|
||||
throw new Error(msg);
|
||||
}
|
||||
|
||||
if (data?.error) {
|
||||
|
||||
+3
-3
@@ -1,5 +1,5 @@
|
||||
{
|
||||
"version": "1.0.153",
|
||||
"buildTime": "2026-02-07T03:32:49.644Z",
|
||||
"buildNumber": 1770435169644
|
||||
"version": "1.0.155",
|
||||
"buildTime": "2026-02-07T03:35:00.822Z",
|
||||
"buildNumber": 1770435300822
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user