Healthchecks and fixes for QR API
This commit is contained in:
@@ -18,7 +18,13 @@ export async function GET(
|
||||
}
|
||||
return Response.json(data);
|
||||
} catch (e) {
|
||||
return Response.json({ error: String(e) }, { status: 502 });
|
||||
return Response.json(
|
||||
{
|
||||
error: 'QR API unreachable',
|
||||
detail: e instanceof Error ? e.message : String(e),
|
||||
},
|
||||
{ status: 502 },
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -43,7 +49,13 @@ export async function PUT(
|
||||
}
|
||||
return Response.json(data);
|
||||
} catch (e) {
|
||||
return Response.json({ error: String(e) }, { status: 502 });
|
||||
return Response.json(
|
||||
{
|
||||
error: 'QR API unreachable',
|
||||
detail: e instanceof Error ? e.message : String(e),
|
||||
},
|
||||
{ status: 502 },
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -65,6 +77,12 @@ export async function DELETE(
|
||||
{ status: res.status },
|
||||
);
|
||||
} catch (e) {
|
||||
return Response.json({ error: String(e) }, { status: 502 });
|
||||
return Response.json(
|
||||
{
|
||||
error: 'QR API unreachable',
|
||||
detail: e instanceof Error ? e.message : String(e),
|
||||
},
|
||||
{ status: 502 },
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,7 +12,13 @@ export async function GET() {
|
||||
}
|
||||
return Response.json(Array.isArray(data) ? data : data);
|
||||
} catch (e) {
|
||||
return Response.json({ error: String(e) }, { status: 502 });
|
||||
return Response.json(
|
||||
{
|
||||
error: 'QR API unreachable',
|
||||
detail: e instanceof Error ? e.message : String(e),
|
||||
},
|
||||
{ status: 502 },
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -33,6 +39,12 @@ export async function POST(request: Request) {
|
||||
}
|
||||
return Response.json(data);
|
||||
} catch (e) {
|
||||
return Response.json({ error: String(e) }, { status: 502 });
|
||||
return Response.json(
|
||||
{
|
||||
error: 'QR API unreachable',
|
||||
detail: e instanceof Error ? e.message : String(e),
|
||||
},
|
||||
{ status: 502 },
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -24,7 +24,13 @@ export async function GET(
|
||||
}
|
||||
return Response.json(data);
|
||||
} catch (e) {
|
||||
return Response.json({ error: String(e) }, { status: 502 });
|
||||
return Response.json(
|
||||
{
|
||||
error: 'QR API unreachable',
|
||||
detail: e instanceof Error ? e.message : String(e),
|
||||
},
|
||||
{ status: 502 },
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -55,7 +61,13 @@ export async function PUT(
|
||||
}
|
||||
return Response.json(data);
|
||||
} catch (e) {
|
||||
return Response.json({ error: String(e) }, { status: 502 });
|
||||
return Response.json(
|
||||
{
|
||||
error: 'QR API unreachable',
|
||||
detail: e instanceof Error ? e.message : String(e),
|
||||
},
|
||||
{ status: 502 },
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -77,6 +89,12 @@ export async function DELETE(
|
||||
{ status: res.status },
|
||||
);
|
||||
} catch (e) {
|
||||
return Response.json({ error: String(e) }, { status: 502 });
|
||||
return Response.json(
|
||||
{
|
||||
error: 'QR API unreachable',
|
||||
detail: e instanceof Error ? e.message : String(e),
|
||||
},
|
||||
{ status: 502 },
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -21,7 +21,13 @@ export async function GET() {
|
||||
}
|
||||
return Response.json(Array.isArray(data) ? rewriteLogoUrl(data) : data);
|
||||
} catch (e) {
|
||||
return Response.json({ error: String(e) }, { status: 502 });
|
||||
return Response.json(
|
||||
{
|
||||
error: 'QR API unreachable',
|
||||
detail: e instanceof Error ? e.message : String(e),
|
||||
},
|
||||
{ status: 502 },
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -42,6 +48,12 @@ export async function POST(request: Request) {
|
||||
}
|
||||
return Response.json(data);
|
||||
} catch (e) {
|
||||
return Response.json({ error: String(e) }, { status: 502 });
|
||||
return Response.json(
|
||||
{
|
||||
error: 'QR API unreachable',
|
||||
detail: e instanceof Error ? e.message : String(e),
|
||||
},
|
||||
{ status: 502 },
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,6 +17,12 @@ export async function POST(request: Request) {
|
||||
}
|
||||
return Response.json(data);
|
||||
} catch (e) {
|
||||
return Response.json({ error: String(e) }, { status: 502 });
|
||||
return Response.json(
|
||||
{
|
||||
error: 'QR API unreachable',
|
||||
detail: e instanceof Error ? e.message : String(e),
|
||||
},
|
||||
{ status: 502 },
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user