File tree Expand file tree Collapse file tree 2 files changed +11
-4
lines changed
packages/core/src/v3/apiClient Expand file tree Collapse file tree 2 files changed +11
-4
lines changed Original file line number Diff line number Diff line change 11import { json } from "@remix-run/server-runtime" ;
2+ import { ServiceValidationError } from "~/v3/services/baseService.server" ;
23import { z } from "zod" ;
34import { createActionApiRoute } from "~/services/routeBuilders/apiBuilder.server" ;
45import { 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) ;
Original file line number Diff line number Diff 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 ) ,
You can’t perform that action at this time.
0 commit comments