mirror of
https://github.com/pezkuwichain/pezkuwi-telegram-miniapp.git
synced 2026-11-21 01:56:11 +00:00
fix: extract actual error from Edge Function response
This commit is contained in:
1 parent
5c6a3f5e67
commit
6b0fb5b90b
3 files changed
+15
-6
No files matched your search
@@ -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) {
|
||||
|
||||
Reference in new issue
Block a user