From 536f47408f21026402c12b11672da2d06d2d8d99 Mon Sep 17 00:00:00 2001 From: Rich Harris Date: Thu, 25 May 2023 13:10:25 -0400 Subject: [PATCH] rename message to body --- packages/kit/src/exports/index.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/kit/src/exports/index.js b/packages/kit/src/exports/index.js index e22ae51f2132..b1d50790c444 100644 --- a/packages/kit/src/exports/index.js +++ b/packages/kit/src/exports/index.js @@ -22,14 +22,14 @@ import { get_route_segments } from '../utils/routing.js'; * return an error response without invoking `handleError`. * Make sure you're not catching the thrown error, which would prevent SvelteKit from handling it. * @param {number} status The [HTTP status code](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#client_error_responses). Must be in the range 400-599. - * @param {{ message: string } extends App.Error ? App.Error | string | undefined : never} message An object that conforms to the App.Error type. If a string is passed, it will be used as the message property. + * @param {{ message: string } extends App.Error ? App.Error | string | undefined : never} body An object that conforms to the App.Error type. If a string is passed, it will be used as the message property. */ -export function error(status, message) { +export function error(status, body) { if ((!BROWSER || DEV) && (isNaN(status) || status < 400 || status > 599)) { throw new Error(`HTTP error status codes must be between 400 and 599 — ${status} is invalid`); } - return new HttpError(status, message); + return new HttpError(status, body); } /**