fix: extract actual error from Edge Function response

This commit is contained in:
2026-02-07 06:35:00 +03:00
parent 5c6a3f5e67
commit 6b0fb5b90b
3 changed files with 15 additions and 6 deletions
+1 -1
View File
@@ -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",
+11 -2
View File
@@ -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
View File
@@ -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
}