@sveltejs/kit 1.0.0-next.540 → 1.0.0-next.541
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -345,10 +345,11 @@ function kit() {
|
|
|
345
345
|
completed_build = false;
|
|
346
346
|
|
|
347
347
|
if (is_build) {
|
|
348
|
-
|
|
348
|
+
if (!vite_config.build.watch) {
|
|
349
|
+
rimraf(paths.build_dir);
|
|
350
|
+
rimraf(paths.output_dir);
|
|
351
|
+
}
|
|
349
352
|
mkdirp(paths.build_dir);
|
|
350
|
-
|
|
351
|
-
rimraf(paths.output_dir);
|
|
352
353
|
mkdirp(paths.output_dir);
|
|
353
354
|
}
|
|
354
355
|
},
|
|
@@ -16,7 +16,6 @@ import {
|
|
|
16
16
|
import { exec } from '../../utils/routing.js';
|
|
17
17
|
import { INVALIDATED_HEADER, render_data } from './data/index.js';
|
|
18
18
|
import { add_cookies_to_headers, get_cookies } from './cookie.js';
|
|
19
|
-
import { HttpError } from '../control.js';
|
|
20
19
|
import { create_fetch } from './fetch.js';
|
|
21
20
|
|
|
22
21
|
/* global __SVELTEKIT_ADAPTER_NAME__ */
|
|
@@ -275,9 +274,8 @@ export async function respond(request, options, state) {
|
|
|
275
274
|
// we can't load the endpoint from our own manifest,
|
|
276
275
|
// so we need to make an actual HTTP request
|
|
277
276
|
return await fetch(request);
|
|
278
|
-
} catch (
|
|
279
|
-
// HttpError can
|
|
280
|
-
const error = e instanceof HttpError ? e : coalesce_to_error(e);
|
|
277
|
+
} catch (error) {
|
|
278
|
+
// HttpError from endpoint can end up here - TODO should it be handled there instead?
|
|
281
279
|
return handle_fatal_error(event, options, error);
|
|
282
280
|
} finally {
|
|
283
281
|
event.cookies.set = () => {
|
|
@@ -362,8 +360,7 @@ export async function respond(request, options, state) {
|
|
|
362
360
|
}
|
|
363
361
|
|
|
364
362
|
return response;
|
|
365
|
-
} catch (
|
|
366
|
-
const error = coalesce_to_error(e);
|
|
363
|
+
} catch (error) {
|
|
367
364
|
return handle_fatal_error(event, options, error);
|
|
368
365
|
}
|
|
369
366
|
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import * as devalue from 'devalue';
|
|
2
|
+
import { coalesce_to_error } from '../../utils/error.js';
|
|
2
3
|
import { negotiate } from '../../utils/http.js';
|
|
3
4
|
import { has_data_suffix } from '../../utils/url.js';
|
|
4
5
|
import { HttpError } from '../control.js';
|
|
@@ -110,9 +111,10 @@ export function static_error_page(options, status, message) {
|
|
|
110
111
|
/**
|
|
111
112
|
* @param {import('types').RequestEvent} event
|
|
112
113
|
* @param {import('types').SSROptions} options
|
|
113
|
-
* @param {
|
|
114
|
+
* @param {unknown} error
|
|
114
115
|
*/
|
|
115
116
|
export function handle_fatal_error(event, options, error) {
|
|
117
|
+
error = error instanceof HttpError ? error : coalesce_to_error(error);
|
|
116
118
|
const status = error instanceof HttpError ? error.status : 500;
|
|
117
119
|
const body = handle_error_and_jsonify(event, options, error);
|
|
118
120
|
|