UNPKG

@astro-utils/forms

Version:

Server component for Astro (call server functions from client side with validation and state management)

15 lines (14 loc) 652 B
import ThrowAction from "./throw-action.js"; export default class ThrowOverrideResponse extends ThrowAction { response?: Response | null; /** * Override the response with a new one. * * If no `Response` is provided, will be use the response stored in `locals.forms.overrideResponse`. * * If no `Response` is stored in `locals.forms.overrideResponse`, will be return the message with error code 500. * @param response - The new response to return. * @param message - The error message to show (if no response is provided / error catch). */ constructor(response?: Response | null, message?: string); }