Skip to content

Commit

Permalink
rename message to body
Browse files Browse the repository at this point in the history
  • Loading branch information
Rich Harris committed May 25, 2023
1 parent 09c13ff commit 536f474
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions packages/kit/src/exports/index.js
Original file line number Diff line number Diff line change
@@ -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);
}

/**

0 comments on commit 536f474

Please sign in to comment.