Starting from the sapper-template, suppose I change blog/index.json.js to the following:
export async function get(req, res) {
throw new Error('OOPPPS');
}
500/blog server side a status code >= 400 triggers the appropriate error message to be renderedAn unhandled promise rejection error is being logged and the error is silently discarted:
(node:14150) UnhandledPromiseRejectionWarning: Unhandled promise rejection
Serving the request hangs forever (server-side rendering simply hangs).
Closing, as this was fixed in #488
As mentioned here the issue is not 100% resolved. Should I open another issue suggesting follow up improvements?
Still remaining to be fixed:
__Expected Behavior__
/blog server side a status code >= 400 triggers the appropriate error message to be renderedAh, my bad. Yes, if you could that'd be very helpful, thanks
for me, this:
{#await promise}
<Loader />
{:then users }
[...]
{:catch error}
<ErrorAlert {error} />
{/await}
<script>
import api from '~/lib/api'
import ErrorAlert from '~/components/ErrorAlert.svelte'
import Loader from '~/components/global/Loader.svelte'
let promise
promise = fetch()
async function fetch () {
return (await api.get(`/users`)).data
}
</script>
is throwing:
(node:27201) UnhandledPromiseRejectionWarning: Error: Request failed with status code 401
at createError (/home/forge/code/node_modules/axios/lib/core/createError.js:16:15)
at settle (/home/forge/code/node_modules/axios/lib/core/settle.js:18:12)
at IncomingMessage.handleStreamEnd (/home/forge/code/node_modules/axios/lib/adapters/http.js:202:11)
at IncomingMessage.emit (events.js:203:15)
at endReadableNT (_stream_readable.js:1145:12)
at process._tickCallback (internal/process/next_tick.js:63:19)
(node:27201) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 2)
(node:27201) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
when running yarn run export
but I can stop it by adding:
// does nothing, but stops UnhandledPromiseRejectionWarning in SSR
$: promise.catch(err => null)
even though I am expecting the {:catch error} to have caught it.
Most helpful comment
for me, this:
is throwing:
when running yarn run export
but I can stop it by adding:
even though I am expecting the
{:catch error}to have caught it.