ThreadSpawnException constructor

ThreadSpawnException(
  1. String message, {
  2. Object? cause,
})

Exception thrown when an Isolate fails to start properly due to issues such as invalid entrypoint, unsupported data, or environment errors.

This is typically used to wrap failures from Isolate.spawn() or similar thread creation operations in JetLeaf or thread libraries.

Example:

try {
  await Isolate.spawn(...);
} catch (e) {
  throw ThreadSpawnException("Failed to start isolate", cause: e);
}

Implementation

ThreadSpawnException(super.message, {super.cause});