Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions assistant/src/runtime/http-server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -630,6 +630,7 @@ export class RuntimeHttpServer {
err.code as HttpErrorCode,
err.message,
err.statusCode,
err.details,
);
}
throw err;
Expand Down
4 changes: 2 additions & 2 deletions assistant/src/runtime/routes/errors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,8 @@ export class UnprocessableEntityError extends RouteError {
}

export class ConflictError extends RouteError {
constructor(message: string) {
super(message, "CONFLICT", 409);
constructor(message: string, details?: unknown) {
super(message, "CONFLICT", 409, details);
this.name = "ConflictError";
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,7 @@ function handleDeleteConnection({ pathParams = {} }: RouteHandlerArgs) {
if ((config.llm?.default as Record<string, unknown> | undefined)?.provider_connection === name) {
throw new ConflictError(
`Connection "${name}" is referenced by llm.default. Update llm.default.provider_connection before deleting.`,
{ referencedBy: ["llm.default"] },
);
}

Expand All @@ -155,6 +156,7 @@ function handleDeleteConnection({ pathParams = {} }: RouteHandlerArgs) {
if (result.error.code === "has_references") {
throw new ConflictError(
`Connection "${name}" is referenced by ${result.error.count} profile(s): ${referencingProfiles.join(", ")}.`,
{ referencedBy: referencingProfiles },
);
}
throw new BadRequestError("Delete failed.");
Expand Down
Loading