Skip to content

Fetch connection errors not caught in error result #233

@truehazker

Description

@truehazker

What version of Elysia is running?

1.4.17

What platform is your computer?

Darwin 25.1.0 arm64 arm

What steps can reproduce the bug?

  1. Create an Eden client pointing to an offline server
  2. Make any request
  3. The promise rejects with an unhandled error instead of returning it in the error field
const client = treaty<App>('http://localhost:9999') // server not running

const { data, error } = await client.get() // throws instead of returning error

What is the expected behavior?

Network errors should be returned in the error field, allowing graceful error handling:

const { data, error } = await client.get()

if (error) {
  console.log(error.status) // 503
  console.log(error.value)  // Error: Unable to connect...
}

What do you see instead?

Unhandled promise rejection:

Unable to connect. Is the computer able to access the url?

Additional information

Affects both treaty and edenFetch clients.

Have you try removing the node_modules and bun.lockb and try again yet?

yes

Fix implementation

#234

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions