Creates an error response with the specified status code and optional message.

  • Parameters

    • status: number

      The HTTP status code for the error.

    • Optionalmessage: string

      An optional custom message for the error.

    • options: ResponseInit = {}

      Optional response initialization options.

    Returns Response

    A Response object representing the error.

    Example usage:

    import { start, router, error } from "@pulsar-http/core";

    const routes = [
    router.get("/not-found", async () => error(404, "The page you requested was not found.")),
    ];

    start({ routes });

    In this example, the response will have a 404 status code and the message "The page you requested was not found.".