mirror of
https://github.com/pezkuwichain/pezkuwi-telegram-miniapp.git
synced 2026-04-22 05:27:54 +00:00
fix: improve edge function error handling and display
This commit is contained in:
+1
-1
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "pezkuwi-telegram-miniapp",
|
||||
"version": "1.0.121",
|
||||
"version": "1.0.122",
|
||||
"type": "module",
|
||||
"description": "Pezkuwichain Telegram Mini App - Forum, Announcements, Rewards",
|
||||
"author": "Pezkuwichain Team",
|
||||
|
||||
+26
-2
@@ -16,8 +16,32 @@ export async function signInWithTelegram(initData: string) {
|
||||
});
|
||||
|
||||
if (error) {
|
||||
console.error('[Auth] Telegram sign-in failed:', error);
|
||||
throw error;
|
||||
// Extract more detailed error message
|
||||
let errorMessage = error.message || 'Unknown error';
|
||||
|
||||
// Check if there's additional context in the error
|
||||
if (error.context?.body) {
|
||||
try {
|
||||
const bodyError = JSON.parse(error.context.body);
|
||||
if (bodyError.error) {
|
||||
errorMessage = bodyError.error;
|
||||
}
|
||||
} catch {
|
||||
// Body is not JSON, use as-is
|
||||
if (typeof error.context.body === 'string') {
|
||||
errorMessage = error.context.body;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
console.error('[Auth] Telegram sign-in failed:', errorMessage);
|
||||
throw new Error(errorMessage);
|
||||
}
|
||||
|
||||
// Check if edge function returned an error in data
|
||||
if (data?.error) {
|
||||
console.error('[Auth] Edge function error:', data.error);
|
||||
throw new Error(data.error);
|
||||
}
|
||||
|
||||
if (data?.session) {
|
||||
|
||||
+3
-3
@@ -1,5 +1,5 @@
|
||||
{
|
||||
"version": "1.0.121",
|
||||
"buildTime": "2026-02-06T16:48:42.195Z",
|
||||
"buildNumber": 1770396522198
|
||||
"version": "1.0.122",
|
||||
"buildTime": "2026-02-06T17:04:46.943Z",
|
||||
"buildNumber": 1770397486943
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user