mirror of
https://github.com/pacnpal/thrilltrack-explorer.git
synced 2025-12-24 21:11:12 -05:00
Improve error handling and navigation safety across the application
Add robust error handling for image uploads, improve navigation logic in AutocompleteSearch with toast notifications for missing identifiers, refine useIsMobile hook return type, and update Supabase function error reporting to handle non-Error types. Replit-Commit-Author: Agent Replit-Commit-Session-Id: a759d451-40bf-440d-96f5-a19ad6af18a8 Replit-Commit-Checkpoint-Type: intermediate_checkpoint
This commit is contained in:
@@ -107,7 +107,7 @@ Deno.serve(async (req) => {
|
||||
return new Response(
|
||||
JSON.stringify({
|
||||
success: false,
|
||||
error: error.message,
|
||||
error: error instanceof Error ? error.message : 'An unknown error occurred',
|
||||
}),
|
||||
{
|
||||
headers: { ...corsHeaders, 'Content-Type': 'application/json' },
|
||||
|
||||
36
supabase/functions/deno.d.ts
vendored
Normal file
36
supabase/functions/deno.d.ts
vendored
Normal file
@@ -0,0 +1,36 @@
|
||||
/// <reference lib="deno.ns" />
|
||||
|
||||
declare module 'https://deno.land/std@*/http/server.ts' {
|
||||
export function serve(handler: (req: Request) => Response | Promise<Response>, options?: { port?: number }): void;
|
||||
}
|
||||
|
||||
declare module 'https://deno.land/std@0.168.0/http/server.ts' {
|
||||
export function serve(handler: (req: Request) => Response | Promise<Response>, options?: { port?: number }): void;
|
||||
}
|
||||
|
||||
declare module 'https://deno.land/std@0.190.0/http/server.ts' {
|
||||
export function serve(handler: (req: Request) => Response | Promise<Response>, options?: { port?: number }): void;
|
||||
}
|
||||
|
||||
declare module 'https://esm.sh/@supabase/supabase-js@2' {
|
||||
export * from '@supabase/supabase-js';
|
||||
}
|
||||
|
||||
declare module 'https://esm.sh/@supabase/supabase-js@2.57.4' {
|
||||
export * from '@supabase/supabase-js';
|
||||
}
|
||||
|
||||
declare module 'npm:@novu/node@2.0.2' {
|
||||
export * from '@novu/node';
|
||||
}
|
||||
|
||||
declare namespace Deno {
|
||||
export namespace env {
|
||||
export function get(key: string): string | undefined;
|
||||
}
|
||||
|
||||
export function serve(
|
||||
handler: (req: Request) => Response | Promise<Response>,
|
||||
options?: { port?: number; hostname?: string }
|
||||
): void;
|
||||
}
|
||||
25
supabase/functions/deno.json
Normal file
25
supabase/functions/deno.json
Normal file
@@ -0,0 +1,25 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"lib": ["deno.window"],
|
||||
"strict": true,
|
||||
"allowJs": true,
|
||||
"noUnusedLocals": false,
|
||||
"noUnusedParameters": false
|
||||
},
|
||||
"imports": {
|
||||
"@supabase/supabase-js": "https://esm.sh/@supabase/supabase-js@2.57.4",
|
||||
"std/": "https://deno.land/std@0.190.0/",
|
||||
"@novu/node": "npm:@novu/node@2.0.2"
|
||||
},
|
||||
"lint": {
|
||||
"rules": {
|
||||
"tags": ["recommended"]
|
||||
}
|
||||
},
|
||||
"fmt": {
|
||||
"indentWidth": 2,
|
||||
"lineWidth": 100,
|
||||
"semiColons": true,
|
||||
"singleQuote": false
|
||||
}
|
||||
}
|
||||
@@ -230,7 +230,7 @@ serve(async (req) => {
|
||||
itemId: item.id,
|
||||
itemType: item.item_type,
|
||||
success: false,
|
||||
error: error.message
|
||||
error: error instanceof Error ? error.message : 'Unknown error'
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -261,7 +261,7 @@ serve(async (req) => {
|
||||
} catch (error) {
|
||||
console.error('Error in process-selective-approval:', error);
|
||||
return new Response(
|
||||
JSON.stringify({ error: error.message }),
|
||||
JSON.stringify({ error: error instanceof Error ? error.message : 'Unknown error' }),
|
||||
{ status: 500, headers: { ...corsHeaders, 'Content-Type': 'application/json' } }
|
||||
);
|
||||
}
|
||||
|
||||
30
supabase/functions/tsconfig.json
Normal file
30
supabase/functions/tsconfig.json
Normal file
@@ -0,0 +1,30 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"target": "ES2021",
|
||||
"lib": ["ES2021", "DOM", "DOM.Iterable"],
|
||||
"module": "ESNext",
|
||||
"moduleResolution": "bundler",
|
||||
"strict": true,
|
||||
"noEmit": true,
|
||||
"skipLibCheck": true,
|
||||
"allowImportingTsExtensions": true,
|
||||
"resolveJsonModule": true,
|
||||
"types": ["./deno.d.ts"],
|
||||
"allowJs": true,
|
||||
"noUnusedLocals": false,
|
||||
"noUnusedParameters": false,
|
||||
"baseUrl": ".",
|
||||
"paths": {
|
||||
"https://deno.land/*": ["*"],
|
||||
"https://esm.sh/*": ["*"],
|
||||
"npm:*": ["*"]
|
||||
}
|
||||
},
|
||||
"include": [
|
||||
"./**/*.ts",
|
||||
"./deno.d.ts"
|
||||
],
|
||||
"exclude": [
|
||||
"node_modules"
|
||||
]
|
||||
}
|
||||
Reference in New Issue
Block a user