Skip to content

Commit 4db1c68

Browse files
committed
review fixes
1 parent dda38b7 commit 4db1c68

File tree

2 files changed

+11
-4
lines changed

2 files changed

+11
-4
lines changed

apps/webapp/app/routes/api.v1.idempotencyKeys.$key.reset.ts

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import { json } from "@remix-run/server-runtime";
2+
import { ServiceValidationError } from "~/v3/services/baseService.server";
23
import { z } from "zod";
34
import { createActionApiRoute } from "~/services/routeBuilders/apiBuilder.server";
45
import { ResetIdempotencyKeyService } from "~/v3/services/resetIdempotencyKey.server";
@@ -27,13 +28,19 @@ export const { action } = createActionApiRoute(
2728
const service = new ResetIdempotencyKeyService();
2829

2930
try {
30-
const result = await service.call(params.key, body.taskIdentifier, authentication.environment);
31+
const result = await service.call(
32+
params.key,
33+
body.taskIdentifier,
34+
authentication.environment
35+
);
3136
return json(result, { status: 200 });
3237
} catch (error) {
33-
if (error instanceof Error) {
34-
return json({ error: error.message }, { status: 404 });
38+
if (error instanceof ServiceValidationError) {
39+
return json({ error: error.message }, { status: error.status ?? 400 });
3540
}
41+
3642
return json({ error: "Internal Server Error" }, { status: 500 });
3743
}
44+
3845
}
3946
);

packages/core/src/v3/apiClient/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -456,7 +456,7 @@ export class ApiClient {
456456
) {
457457
return zodfetch(
458458
ResetIdempotencyKeyResponse,
459-
`${this.baseUrl}/api/v1/idempotency-keys/${encodeURIComponent(idempotencyKey)}/reset`,
459+
`${this.baseUrl}/api/v1/idempotencyKeys/${encodeURIComponent(idempotencyKey)}/reset`,
460460
{
461461
method: "POST",
462462
headers: this.#getHeaders(false),

0 commit comments

Comments
 (0)