mirror of
https://github.com/withastro/astro.git
synced 2025-03-10 23:01:26 -05:00
chore: refine enhance: true error message
This commit is contained in:
parent
e11ab41fb2
commit
171aad839c
1 changed files with 3 additions and 3 deletions
|
@ -20,9 +20,9 @@ export function defineAction<TOutput, TInputSchema extends z.ZodType>({
|
|||
if (!enhance && (ContentType !== 'application/json' || unparsedInput instanceof FormData)) {
|
||||
// TODO: prettify dev server error
|
||||
throw new ActionError({
|
||||
status: 'BAD_REQUEST',
|
||||
status: 'INTERNAL_SERVER_ERROR',
|
||||
message:
|
||||
'This action only accepts JSON. To enhance this action to accept form data, add `enhance: true` to your `defineAction()` config.',
|
||||
'Called an action with a non-JSON body. To enhance an action to accept form data, add `enhance: true` to your `defineAction()` config.',
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -31,7 +31,7 @@ export function defineAction<TOutput, TInputSchema extends z.ZodType>({
|
|||
if (enhance && unparsedInput instanceof FormData) {
|
||||
if (!(inputSchema instanceof z.ZodObject)) {
|
||||
throw new ActionError({
|
||||
status: 'BAD_REQUEST',
|
||||
status: 'INTERNAL_SERVER_ERROR',
|
||||
message: '`input` must use a Zod object schema (z.object) when `enhance` is enabled.',
|
||||
});
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue