mirror of
https://github.com/Sea-Haven-Industries/open-swe.git
synced 2026-09-30 09:13:14 +00:00
chore: add error logs (#815)
* chore: add error logs * chore: add error logs
This commit is contained in:
parent
8c1fbfac3c
commit
998655385b
2 changed files with 37 additions and 3 deletions
|
|
@ -68,7 +68,8 @@ export async function getInstallationNameFromReq(
|
|||
installationId: string,
|
||||
): Promise<string> {
|
||||
try {
|
||||
const requestJson = await req.json();
|
||||
const reqCopy = req.clone();
|
||||
const requestJson = await reqCopy.json();
|
||||
const installationName = requestJson?.input?.targetRepository?.owner;
|
||||
if (installationName) {
|
||||
return installationName;
|
||||
|
|
@ -79,7 +80,8 @@ export async function getInstallationNameFromReq(
|
|||
|
||||
try {
|
||||
return await getInstallationName(installationId);
|
||||
} catch {
|
||||
} catch (error) {
|
||||
console.error("Failed to get installation name:", error);
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -105,7 +105,8 @@ async function createNewSession(
|
|||
*/
|
||||
export async function POST(request: NextRequest): Promise<NextResponse> {
|
||||
try {
|
||||
const body: RestartRunRequest = await request.json();
|
||||
const reqCopy = request.clone();
|
||||
const body: RestartRunRequest = await reqCopy.json();
|
||||
const { managerThreadId, plannerThreadId, programmerThreadId } = body;
|
||||
|
||||
const langGraphClient = new Client({
|
||||
|
|
@ -142,6 +143,37 @@ export async function POST(request: NextRequest): Promise<NextResponse> {
|
|||
);
|
||||
}
|
||||
|
||||
if (!("config" in managerThread)) {
|
||||
console.error("Manager thread must have a config.");
|
||||
console.dir(managerThread, { depth: null });
|
||||
return NextResponse.json(
|
||||
{
|
||||
error: "Failed to restart run. Manager thread must have a config.",
|
||||
},
|
||||
{ status: 500 },
|
||||
);
|
||||
}
|
||||
if (!("config" in plannerThread)) {
|
||||
console.error("Planner thread must have a config.");
|
||||
console.dir(plannerThread, { depth: null });
|
||||
return NextResponse.json(
|
||||
{
|
||||
error: "Failed to restart run. Planner thread must have a config.",
|
||||
},
|
||||
{ status: 500 },
|
||||
);
|
||||
}
|
||||
if (programmerThread && !("config" in programmerThread)) {
|
||||
console.error("Programmer thread must have a config.");
|
||||
console.dir(programmerThread, { depth: null });
|
||||
return NextResponse.json(
|
||||
{
|
||||
error: "Failed to restart run. Programmer thread must have a config.",
|
||||
},
|
||||
{ status: 500 },
|
||||
);
|
||||
}
|
||||
|
||||
const newProgrammerSession = programmerThreadState
|
||||
? await createNewSession(langGraphClient, {
|
||||
graphId: PROGRAMMER_GRAPH_ID,
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue