lgi-devs / lgi-devs/lgi

Async helpers return value and behaviour on error

Open
#192 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Lua
Stars
491
Forks
81
PR merge metrics
No merged PRs in 30d

Description

This is totally inconsistent:

call

  • success:
    returns the values from the wrapped coroutine. This is good.
  • error before first yield:
    hangs
  • error on subsequent yields (assuming the coroutine was passed as a callback):
    rethrows error, which means it longjumps out of the gio function and main loop. I don't think this is a safe thing. Rethrowing only happens with coroutine callbacks, normal function callbacks (eg. not using Async helper) just log a warning on error.

start

  • success:
    returns true and return value from first yield
  • error on first yield:
    false and error
  • error on subsequent yields:
    rethrow

I just wanted to make a PR to fix the hang, but I don't even know what these functions supposed to do on error.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the async helper entry points call and start, then reproduce the listed success and error cases for coroutine and normal callbacks. Before changing behavior, establish the intended error contract; done means consistent, documented return and error behavior across first and subsequent yields without hanging or escaping the main loop.

Written by the indexing model from the issue text.

Assessment

Tech stack
lua
Domain
backend-api-design
Issue type
Bug
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.