Skip to content

fix(input): return (nil, err) on read_query_answer timeout#202

Merged
Tieske merged 4 commits intolunarmodules:mainfrom
tanmayrajurkar:fix/input-read-query-answer-timeout
Feb 21, 2026
Merged

fix(input): return (nil, err) on read_query_answer timeout#202
Tieske merged 4 commits intolunarmodules:mainfrom
tanmayrajurkar:fix/input-read-query-answer-timeout

Conversation

@tanmayrajurkar
Copy link
Contributor

Replace error() in read_query_answer() with
return nil, "timeout: no response from terminal".

This aligns the function with our (value, err) return
convention which has beed used throughout the input module and CLI widgets.
query() already uses this pattern.

Adds LDoc notes for the error return and Busted tests covering
timeout behavior in both read_query_answer() and query().

There is No behavioral change except preventing a hard crash on timeout.

@Tieske
Copy link
Member

Tieske commented Feb 20, 2026

this code is actually there on purpose. It's unclear to me wehther this could ever happen. Hence the "this is unexpected" error, to ensure we'd get feedback if it ever did happen.

That said, whenever you think something cannot happen, it typically happens. So maybe this is a good change. Wdyt?

@tanmayrajurkar
Copy link
Contributor Author

tanmayrajurkar commented Feb 20, 2026

@Tieske I understand that using error() makes sure we notice if something truely happen which is causing a crash.

My reasoning was mostly about API boundaries most of the input layer follows our new (value, err) pattern, so throwing here forces downstream callers to wrap in pcall(), which feels inconsistent with the rest of the module’s public surface.

@Tieske Tieske merged commit 179ea45 into lunarmodules:main Feb 21, 2026
8 checks passed
@tanmayrajurkar tanmayrajurkar deleted the fix/input-read-query-answer-timeout branch February 21, 2026 19:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants