Commit c57bc574 authored by Hendrik Garske's avatar Hendrik Garske

Fix: Verbleibende any-Typen in customers route korrigiert

parent 629ab9a4
Pipeline #12 passed with stages
in 2 minutes
...@@ -58,21 +58,22 @@ export async function POST(request: NextRequest) { ...@@ -58,21 +58,22 @@ export async function POST(request: NextRequest) {
}) })
return NextResponse.json(customer, { status: 201 }) return NextResponse.json(customer, { status: 201 })
} catch (dbError: any) { } catch (dbError: unknown) {
console.error("Database error creating customer:", dbError) console.error("Database error creating customer:", dbError)
const errorMessage = dbError?.message || "Database error occurred" const errorMessage = dbError instanceof Error ? dbError.message : "Database error occurred"
const errorCode = (dbError as { code?: string })?.code
return NextResponse.json( return NextResponse.json(
{ {
error: errorMessage, error: errorMessage,
code: dbError?.code, code: errorCode,
details: process.env.NODE_ENV === 'development' ? dbError?.stack : undefined details: process.env.NODE_ENV === 'development' && dbError instanceof Error ? dbError.stack : undefined
}, },
{ status: 500 } { status: 500 }
) )
} }
} catch (error: any) { } catch (error: unknown) {
console.error("Error in POST /api/customers:", error) console.error("Error in POST /api/customers:", error)
const errorMessage = error?.message || error?.toString() || "Failed to process request" const errorMessage = error instanceof Error ? error.message : String(error)
return NextResponse.json( return NextResponse.json(
{ {
error: errorMessage, error: errorMessage,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment