Skip to content

Commit b2b1b02

Browse files
committed
fix overloaded error method jsdocs
1 parent ea0747c commit b2b1b02

File tree

1 file changed

+14
-8
lines changed

1 file changed

+14
-8
lines changed

packages/kit/src/exports/index.js

+14-8
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,11 @@ export { VERSION } from '../version.js';
2424
* When called during request handling, this will cause SvelteKit to
2525
* return an error response without invoking `handleError`.
2626
* Make sure you're not catching the thrown error, which would prevent SvelteKit from handling it.
27-
*
28-
* @overload
2927
* @param {NumericRange<400, 599>} 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.
3028
* @param {App.Error} body An object that conforms to the App.Error type. If a string is passed, it will be used as the message property.
29+
* @overload
30+
* @param {NumericRange<400, 599>} status
31+
* @param {App.Error} body
3132
* @return {never}
3233
* @throws {HttpError} This error instructs SvelteKit to initiate HTTP error handling.
3334
* @throws {Error} If the provided status is invalid (not between 400 and 599).
@@ -37,20 +38,25 @@ export { VERSION } from '../version.js';
3738
* When called during request handling, this will cause SvelteKit to
3839
* return an error response without invoking `handleError`.
3940
* Make sure you're not catching the thrown error, which would prevent SvelteKit from handling it.
40-
*
41-
* @overload
4241
* @param {NumericRange<400, 599>} 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.
4342
* @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.
43+
* @overload
44+
* @param {NumericRange<400, 599>} status
45+
* @param {{ message: string } extends App.Error ? App.Error | string | undefined : never} [body]
4446
* @return {never}
4547
* @throws {HttpError} This error instructs SvelteKit to initiate HTTP error handling.
4648
* @throws {Error} If the provided status is invalid (not between 400 and 599).
4749
*/
4850
/**
49-
* @param {NumericRange<400, 599>} status
50-
* @param {{ message: string } extends App.Error ? App.Error | string | undefined : never} body
51+
* Throws an error with a HTTP status code and an optional message.
52+
* When called during request handling, this will cause SvelteKit to
53+
* return an error response without invoking `handleError`.
54+
* Make sure you're not catching the thrown error, which would prevent SvelteKit from handling it.
55+
* @param {NumericRange<400, 599>} 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.
56+
* @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.
5157
* @return {never}
52-
* @throws {HttpError}
53-
* @throws {Error}
58+
* @throws {HttpError} This error instructs SvelteKit to initiate HTTP error handling.
59+
* @throws {Error} If the provided status is invalid (not between 400 and 599).
5460
*/
5561
export function error(status, body) {
5662
if ((!BROWSER || DEV) && (isNaN(status) || status < 400 || status > 599)) {

0 commit comments

Comments
 (0)