File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -41,7 +41,7 @@ export async function POST(request: NextRequest) {
4141 cleanupExpired ( ) ;
4242
4343 if ( ! PASSWORD ) {
44- return NextResponse . json ( { error : "No password configured " } , { status : 500 } ) ;
44+ return NextResponse . json ( { error : "Internal Server Error " } , { status : 500 } ) ;
4545 }
4646
4747 const clientIP = getClientIP ( request ) ;
Original file line number Diff line number Diff line change @@ -33,6 +33,7 @@ export async function GET(request: Request) {
3333 const data = await res . json ( ) ;
3434 return NextResponse . json ( data , { status : 200 } ) ;
3535 } catch ( error ) {
36- return NextResponse . json ( { error : ( error as Error ) . message } , { status : 500 } ) ;
36+ console . error ( "/api/logs failed:" , error ) ;
37+ return NextResponse . json ( { error : "Internal Server Error" } , { status : 500 } ) ;
3738 }
3839}
Original file line number Diff line number Diff line change @@ -82,6 +82,7 @@ export async function GET(request: Request) {
8282 setCached ( cacheKey , payload ) ;
8383 return NextResponse . json ( payload , { status : 200 } ) ;
8484 } catch ( error ) {
85- return NextResponse . json ( { error : ( error as Error ) . message } , { status : 500 } ) ;
85+ console . error ( "/api/overview failed:" , error ) ;
86+ return NextResponse . json ( { error : "Internal Server Error" } , { status : 500 } ) ;
8687 }
8788}
Original file line number Diff line number Diff line change @@ -33,7 +33,8 @@ export async function GET() {
3333 } ) ) ;
3434 return NextResponse . json ( normalized , { status : 200 } ) ;
3535 } catch ( error ) {
36- return NextResponse . json ( { error : ( error as Error ) . message } , { status : 500 } ) ;
36+ console . error ( "/api/prices GET failed:" , error ) ;
37+ return NextResponse . json ( { error : "Internal Server Error" } , { status : 500 } ) ;
3738 }
3839}
3940
@@ -66,7 +67,8 @@ export async function POST(request: Request) {
6667
6768 return NextResponse . json ( { ok : true } , { status : 200 } ) ;
6869 } catch ( error ) {
69- return NextResponse . json ( { error : ( error as Error ) . message } , { status : 500 } ) ;
70+ console . error ( "/api/prices POST failed:" , error ) ;
71+ return NextResponse . json ( { error : "Internal Server Error" } , { status : 500 } ) ;
7072 }
7173}
7274
@@ -88,6 +90,7 @@ export async function DELETE(request: Request) {
8890 await db . delete ( modelPrices ) . where ( eq ( modelPrices . model , parsed . data . model ) ) ;
8991 return NextResponse . json ( { ok : true } , { status : 200 } ) ;
9092 } catch ( error ) {
91- return NextResponse . json ( { error : ( error as Error ) . message } , { status : 500 } ) ;
93+ console . error ( "/api/prices DELETE failed:" , error ) ;
94+ return NextResponse . json ( { error : "Internal Server Error" } , { status : 500 } ) ;
9295 }
9396}
Original file line number Diff line number Diff line change @@ -39,6 +39,7 @@ export async function GET(request: Request) {
3939 const data = await res . json ( ) ;
4040 return NextResponse . json ( data , { status : 200 } ) ;
4141 } catch ( error ) {
42- return NextResponse . json ( { error : ( error as Error ) . message } , { status : 500 } ) ;
42+ console . error ( "/api/request-error-logs failed:" , error ) ;
43+ return NextResponse . json ( { error : "Internal Server Error" } , { status : 500 } ) ;
4344 }
4445}
Original file line number Diff line number Diff line change @@ -79,8 +79,9 @@ async function performSync(request: Request) {
7979 const json = await response . json ( ) ;
8080 payload = parseUsagePayload ( json ) ;
8181 } catch ( parseError ) {
82+ console . error ( "/api/sync parse upstream usage failed:" , parseError ) ;
8283 return NextResponse . json (
83- { error : "Failed to parse usage response" , detail : ( parseError as Error ) . message } ,
84+ { error : "Bad Gateway" } ,
8485 { status : 502 }
8586 ) ;
8687 }
@@ -99,8 +100,9 @@ async function performSync(request: Request) {
99100 . onConflictDoNothing ( { target : [ usageRecords . occurredAt , usageRecords . route , usageRecords . model ] } )
100101 . returning ( { id : usageRecords . id } ) ;
101102 } catch ( dbError ) {
103+ console . error ( "/api/sync database insert failed:" , dbError ) ;
102104 return NextResponse . json (
103- { error : "Database insert failed" , detail : ( dbError as Error ) . message } ,
105+ { error : "Internal Server Error" } ,
104106 { status : 500 }
105107 ) ;
106108 }
Original file line number Diff line number Diff line change @@ -29,7 +29,8 @@ export async function GET() {
2929 const data = await res . json ( ) ;
3030 return NextResponse . json ( data , { status : 200 } ) ;
3131 } catch ( error ) {
32- return NextResponse . json ( { error : ( error as Error ) . message } , { status : 500 } ) ;
32+ console . error ( "/api/usage-statistics-enabled GET failed:" , error ) ;
33+ return NextResponse . json ( { error : "Internal Server Error" } , { status : 500 } ) ;
3334 }
3435}
3536
@@ -59,6 +60,7 @@ export async function POST(request: Request) {
5960
6061 return NextResponse . json ( { "usage-statistics-enabled" : value } , { status : 200 } ) ;
6162 } catch ( error ) {
62- return NextResponse . json ( { error : ( error as Error ) . message } , { status : 500 } ) ;
63+ console . error ( "/api/usage-statistics-enabled POST failed:" , error ) ;
64+ return NextResponse . json ( { error : "Internal Server Error" } , { status : 500 } ) ;
6365 }
6466}
You can’t perform that action at this time.
0 commit comments