@@ -44,6 +44,7 @@ export class SafeActionClient<
44
44
readonly #handleValidationErrorsShape: HandleValidationErrorsShapeFn < S , CVE > ;
45
45
readonly #handleBindArgsValidationErrorsShape: HandleBindArgsValidationErrorsShapeFn < BAS , CBAVE > ;
46
46
readonly #defaultValidationErrorsShape: ODVES ;
47
+ readonly #throwValidationErrors: boolean ;
47
48
48
49
constructor (
49
50
opts : {
@@ -59,7 +60,7 @@ export class SafeActionClient<
59
60
} & Required <
60
61
Pick <
61
62
SafeActionClientOpts < ServerError , any , ODVES > ,
62
- "handleReturnedServerError" | "handleServerErrorLog" | "defaultValidationErrorsShape"
63
+ "handleReturnedServerError" | "handleServerErrorLog" | "defaultValidationErrorsShape" | "throwValidationErrors"
63
64
>
64
65
>
65
66
) {
@@ -74,6 +75,7 @@ export class SafeActionClient<
74
75
this . #handleValidationErrorsShape = opts . handleValidationErrorsShape ;
75
76
this . #handleBindArgsValidationErrorsShape = opts . handleBindArgsValidationErrorsShape ;
76
77
this . #defaultValidationErrorsShape = opts . defaultValidationErrorsShape ;
78
+ this . #throwValidationErrors = opts . throwValidationErrors ;
77
79
}
78
80
79
81
/**
@@ -96,6 +98,7 @@ export class SafeActionClient<
96
98
handleBindArgsValidationErrorsShape : this . #handleBindArgsValidationErrorsShape,
97
99
ctxType : undefined as NextCtx ,
98
100
defaultValidationErrorsShape : this . #defaultValidationErrorsShape,
101
+ throwValidationErrors : this . #throwValidationErrors,
99
102
} ) ;
100
103
}
101
104
@@ -119,6 +122,7 @@ export class SafeActionClient<
119
122
handleBindArgsValidationErrorsShape : this . #handleBindArgsValidationErrorsShape,
120
123
ctxType : undefined as Ctx ,
121
124
defaultValidationErrorsShape : this . #defaultValidationErrorsShape,
125
+ throwValidationErrors : this . #throwValidationErrors,
122
126
} ) ;
123
127
}
124
128
@@ -160,6 +164,7 @@ export class SafeActionClient<
160
164
handleBindArgsValidationErrorsShape : this . #handleBindArgsValidationErrorsShape,
161
165
ctxType : undefined as Ctx ,
162
166
defaultValidationErrorsShape : this . #defaultValidationErrorsShape,
167
+ throwValidationErrors : this . #throwValidationErrors,
163
168
} ) ;
164
169
}
165
170
@@ -193,6 +198,7 @@ export class SafeActionClient<
193
198
this . #handleBindArgsValidationErrorsShape) as HandleBindArgsValidationErrorsShapeFn < OBAS , OCBAVE > ,
194
199
ctxType : undefined as Ctx ,
195
200
defaultValidationErrorsShape : this . #defaultValidationErrorsShape,
201
+ throwValidationErrors : this . #throwValidationErrors,
196
202
} ) ;
197
203
}
198
204
@@ -219,6 +225,7 @@ export class SafeActionClient<
219
225
bindArgsSchemas : this . #bindArgsSchemas,
220
226
handleValidationErrorsShape : this . #handleValidationErrorsShape,
221
227
handleBindArgsValidationErrorsShape : this . #handleBindArgsValidationErrorsShape,
228
+ throwValidationErrors : this . #throwValidationErrors,
222
229
} ) . action ( serverCodeFn , cb ) ;
223
230
}
224
231
@@ -246,6 +253,7 @@ export class SafeActionClient<
246
253
bindArgsSchemas : this . #bindArgsSchemas,
247
254
handleValidationErrorsShape : this . #handleValidationErrorsShape,
248
255
handleBindArgsValidationErrorsShape : this . #handleBindArgsValidationErrorsShape,
256
+ throwValidationErrors : this . #throwValidationErrors,
249
257
} ) . stateAction ( serverCodeFn , cb ) ;
250
258
}
251
259
}
0 commit comments