This repository has been archived by the owner on Jan 11, 2023. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 432
Error thrown from async routes not being handled #487
Labels
Comments
nikku
added a commit
to nikku/sapper
that referenced
this issue
Oct 20, 2018
Related to sveltejs#487
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
|
Ah, 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:
even though I am expecting the |
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Starting from the sapper-template, suppose I change
blog/index.json.js
to the following:Expected Behavior
500
/blog
server side a status code>= 400
triggers the appropriate error message to be renderedActual Behavior
An unhandled promise rejection error is being logged and the error is silently discarted:
Serving the request hangs forever (server-side rendering simply hangs).
Environment
sapper@0.23.3
The text was updated successfully, but these errors were encountered: