@@ -1080,7 +1080,7 @@ export type ActionResult<
1080
1080
* Creates an `HttpError` object with an HTTP status code and an optional message.
1081
1081
* This object, if thrown during request handling, will cause SvelteKit to
1082
1082
* return an error response without invoking `handleError`
1083
- * @param status The HTTP status code
1083
+ * @param 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.
1084
1084
* @param body An object that conforms to the App.Error type. If a string is passed, it will be used as the message property.
1085
1085
*/
1086
1086
export function error ( status : number , body : App . Error ) : HttpError ;
@@ -1094,15 +1094,16 @@ export function error(
1094
1094
* The object returned by the [`error`](https://kit.svelte.dev/docs/modules#sveltejs-kit-error) function.
1095
1095
*/
1096
1096
export interface HttpError {
1097
- /** The [HTTP status code](https://httpstatusdogs.com ), in the range 400-599 */
1097
+ /** The [HTTP status code](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#client_error_responses ), in the range 400-599. */
1098
1098
status : number ;
1099
1099
/** The content of the error. */
1100
1100
body : App . Error ;
1101
1101
}
1102
1102
1103
1103
/**
1104
- * Create a `Redirect` object. If thrown during request handling, SvelteKit will
1105
- * return a redirect response.
1104
+ * Create a `Redirect` object. If thrown during request handling, SvelteKit will return a redirect response.
1105
+ * @param status The [HTTP status code](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#redirection_messages). Must be in the range 300-308.
1106
+ * @param location The location to redirect to.
1106
1107
*/
1107
1108
export function redirect (
1108
1109
status : 300 | 301 | 302 | 303 | 304 | 305 | 306 | 307 | 308 ,
@@ -1113,7 +1114,7 @@ export function redirect(
1113
1114
* The object returned by the [`redirect`](https://kit.svelte.dev/docs/modules#sveltejs-kit-redirect) function
1114
1115
*/
1115
1116
export interface Redirect {
1116
- /** The [HTTP status code](https://httpstatusdogs.com ), in the range 300-308. */
1117
+ /** The [HTTP status code](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#redirection_messages ), in the range 300-308. */
1117
1118
status : 300 | 301 | 302 | 303 | 304 | 305 | 306 | 307 | 308 ;
1118
1119
/** The location to redirect to. */
1119
1120
location : string ;
@@ -1128,6 +1129,8 @@ export function json(data: any, init?: ResponseInit): Response;
1128
1129
1129
1130
/**
1130
1131
* Create an `ActionFailure` object.
1132
+ * @param 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.
1133
+ * @param data Data associated with the failure (e.g. validation errors)
1131
1134
*/
1132
1135
export function fail < T extends Record < string , unknown > | undefined > (
1133
1136
status : number ,
@@ -1139,7 +1142,9 @@ export function fail<T extends Record<string, unknown> | undefined>(
1139
1142
*/
1140
1143
export interface ActionFailure < T extends Record < string , unknown > | undefined = undefined >
1141
1144
extends UniqueInterface {
1145
+ /** The [HTTP status code](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#client_error_responses), in the range 400-599. */
1142
1146
status : number ;
1147
+ /** Data associated with the failure (e.g. validation errors) */
1143
1148
data : T ;
1144
1149
}
1145
1150
0 commit comments