fix(confidence-engine): log case-start failures
This commit is contained in:
@@ -16,10 +16,25 @@ export async function POST(request) {
|
||||
? result.statusCode
|
||||
: 500;
|
||||
|
||||
const diagnostics = {
|
||||
status,
|
||||
error: result.error ?? "Start case failed",
|
||||
validationErrors: result.validationErrors,
|
||||
analysisErrors: result.analysisErrors,
|
||||
validationIssues: result.validationIssues,
|
||||
rawResponse: result.rawResponse ?? undefined,
|
||||
};
|
||||
|
||||
if (status >= 500) {
|
||||
console.error("[api/cases/start] error response", diagnostics);
|
||||
} else {
|
||||
console.warn("[api/cases/start] error response", diagnostics);
|
||||
}
|
||||
|
||||
return Response.json(
|
||||
{
|
||||
success: false,
|
||||
error: result.error ?? "Start case failed",
|
||||
error: diagnostics.error,
|
||||
validationErrors: result.validationErrors,
|
||||
diagnostics: result.diagnostics,
|
||||
analysisErrors: result.analysisErrors,
|
||||
@@ -28,7 +43,12 @@ export async function POST(request) {
|
||||
},
|
||||
{ status },
|
||||
);
|
||||
} catch {
|
||||
} catch (error) {
|
||||
console.error("[api/cases/start] unhandled exception", {
|
||||
message: error instanceof Error ? error.message : String(error),
|
||||
stack: error instanceof Error ? error.stack : undefined,
|
||||
error,
|
||||
});
|
||||
return Response.json(
|
||||
{
|
||||
success: false,
|
||||
|
||||
Reference in New Issue
Block a user