feat(api): incluir detalhes de erro em /api/machines/register e /api/machines/heartbeat (facilita diagnostico em PROD)
This commit is contained in:
parent
833adcd8fa
commit
d9ab863e76
2 changed files with 4 additions and 2 deletions
|
|
@ -57,6 +57,7 @@ export async function POST(request: Request) {
|
||||||
return jsonWithCors(response, 200, request.headers.get("origin"), CORS_METHODS)
|
return jsonWithCors(response, 200, request.headers.get("origin"), CORS_METHODS)
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error("[machines.heartbeat] Falha ao registrar heartbeat", error)
|
console.error("[machines.heartbeat] Falha ao registrar heartbeat", error)
|
||||||
return jsonWithCors({ error: "Falha ao registrar heartbeat" }, 500, request.headers.get("origin"), CORS_METHODS)
|
const details = error instanceof Error ? error.message : String(error)
|
||||||
|
return jsonWithCors({ error: "Falha ao registrar heartbeat", details }, 500, request.headers.get("origin"), CORS_METHODS)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -102,6 +102,7 @@ export async function POST(request: Request) {
|
||||||
)
|
)
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error("[machines.register] Falha no provisionamento", error)
|
console.error("[machines.register] Falha no provisionamento", error)
|
||||||
return jsonWithCors({ error: "Falha ao provisionar máquina" }, 500, request.headers.get("origin"), CORS_METHODS)
|
const details = error instanceof Error ? error.message : String(error)
|
||||||
|
return jsonWithCors({ error: "Falha ao provisionar máquina", details }, 500, request.headers.get("origin"), CORS_METHODS)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue