Skip to content

Commit bd93fac

Browse files
committed
Bug fixes in deletion and conflicts
1 parent caabacd commit bd93fac

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

backend/src/db/repo/app.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -124,10 +124,10 @@ export class AppRepo {
124124
err.code === "P2002"
125125
) {
126126
// P2002 is "Unique Constraint Failed" - https://www.prisma.io/docs/orm/reference/error-reference#p2002
127-
throw new ConflictError(
128-
err.meta?.target as string /* column name */,
129-
err,
130-
);
127+
const target = Array.isArray(err.meta?.target)
128+
? err.meta.target.join(", ")
129+
: (err.meta?.target as string);
130+
throw new ConflictError(target);
131131
}
132132
}
133133

backend/src/lib/cluster/kubernetes.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ export const deleteNamespace = async (
159159
metadata: { name },
160160
});
161161
} catch (err) {
162-
if (err instanceof ApiException && err.code === 404) {
162+
if (err instanceof ApiException && (err.code === 404 || err.code === 403)) {
163163
return;
164164
}
165165
throw err;

backend/src/lib/registry.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ export async function deleteRepo(name: string) {
1111
}
1212

1313
await fetch(
14-
`${env.REGISTRY_PROTOCOL}://${env.REGISTRY_HOSTNAME}/projects/${env.HARBOR_PROJECT_NAME}/repositories/${name}`,
14+
`${env.REGISTRY_PROTOCOL}://${env.REGISTRY_HOSTNAME}/api/v2.0/projects/${env.HARBOR_PROJECT_NAME}/repositories/${name}`,
1515
{
1616
method: "DELETE",
1717
headers,

0 commit comments

Comments
 (0)