Healthchecks and fixes for QR API
Some checks failed
ci/woodpecker/push/ci Pipeline failed
ci/woodpecker/push/deploy unknown status

This commit is contained in:
2026-02-07 14:45:02 -03:00
parent 771d0ccf27
commit ace33435fb
9 changed files with 164 additions and 19 deletions

View File

@@ -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 },
);
}
}

View File

@@ -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 },
);
}
}

View File

@@ -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 },
);
}
}

View File

@@ -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 },
);
}
}

View File

@@ -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 },
);
}
}