Skip to content

Bridging Dart Exceptions with Isolates: Addressing the Incompatibility #59608

@stephane-archer

Description

@stephane-archer

When exploring the Dart standard library, it becomes evident that exceptions are the primary mechanism for handling errors. This approach works seamlessly in most scenarios—until you introduce isolates into the equation. Isolates rely on values to handle errors, creating a dissonance between the two paradigms.

This mismatch forces developers to write wrapper functions to convert exceptions into value-based errors to make them compatible with isolates. This process can be tedious and introduces unnecessary complexity, especially when working with existing Dart codebases.

A potential improvement would be enabling isolates to propagate exceptions back to the sender. This enhancement could significantly reduce the friction caused by this inconsistency, allowing for a more harmonious interaction between isolates and Dart's standard error-handling mechanisms.

Currently, this disconnect makes it cumbersome to leverage isolates effectively within Dart, particularly in projects that depend on exception-driven error handling.

Metadata

Metadata

Assignees

No one assigned

    Labels

    area-core-librarySDK core library issues (core, async, ...); use area-vm or area-web for platform specific libraries.library-asynctype-enhancementA request for a change that isn't a bug

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions