Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to bubble up 'Uncaught in promise' exception #8689

Open
tonprince opened this issue Jun 2, 2023 · 0 comments
Open

Unable to bubble up 'Uncaught in promise' exception #8689

tonprince opened this issue Jun 2, 2023 · 0 comments

Comments

@tonprince
Copy link

Describe the bug

It is not possible to catch an error within an await-then block.

<script>
  import { createBoundary } from './ErrorBoundary.js';
  import FirestackError from './FirestackError.svelte';
  
  let Boundary = createBoundary(FirestackError);
  
  async function getUsers() {
    return ["aaa", "sss"];
  }
</script>
  
<Boundary>
  {#await getUsers() then users}
    {users.error()}
  {/await}
</Boundary>

If I remove the async declaration on the getUsers function, the error is caugth and handled by the boundary error handler.

Reproduction

https://github.com/tonprince/uncaught-in-promise

Logs

Uncaught (in promise) TypeError: ctx[1].error is not a function
    create_then_block +page.svelte:14
    update2 index.mjs:1655
    handle_promise index.mjs:1690
    promise callback*handle_promise index.mjs:1688
    create_default_slot +page.svelte:118
    guarded ErrorBoundary.js:24
    default ErrorBoundary.js:38
    create_slot index.mjs:71
    create_else_block FirestackError.svelte:42
    create_fragment FirestackError.svelte:211
    init index.mjs:2180
    FirestackError FirestackError.svelte:318
    createProxiedComponent svelte-hooks.js:341
    ProxyComponent proxy.js:242
    Proxy<FirestackError> proxy.js:349
    ErrorBoundaryComponent ErrorBoundary.js:52
    create_fragment +page.svelte:162
    init index.mjs:2180
    Page +page.svelte:250
    createComponent svelte-hooks.js:206
    $replace svelte-hooks.js:269
    refreshComponent proxy.js:171
    rerender proxy-adapter-dom.js:77
    reload proxy.js:408
    reload proxy.js:406
    applyHmr hot-api.js:150
    accept client.ts:542
    fetchUpdate client.ts:459
    queueUpdate client.ts:306
    queueUpdate client.ts:306
    handleMessage client.ts:159
    handleMessage client.ts:157
    setupWebSocket client.ts:90
    setupWebSocket client.ts:89
    <anonymous> client.ts:67
+page.svelte:14:13

System Info

System:
    OS: macOS 13.3.1
    CPU: (8) arm64 Apple M2
    Memory: 88.41 MB / 8.00 GB
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 18.13.0 - ~/.nvm/versions/node/v18.13.0/bin/node
    npm: 8.19.3 - ~/.nvm/versions/node/v18.13.0/bin/npm
  Browsers:
    Chrome: 114.0.5735.90
    Firefox: 113.0.2
    Safari: 16.4
  npmPackages:
    @sveltejs/adapter-auto: ^2.1.0 => 2.1.0 
    @sveltejs/kit: ^1.20.1 => 1.20.1 
    svelte: ^3.59.1 => 3.59.1 
    vite: ^4.3.9 => 4.3.9

Severity

annoyance

Additional Information

No response

@gtm-nayan gtm-nayan transferred this issue from sveltejs/kit Jun 3, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant