Skip to content

fix: unwrap inner TaskError code from TaskRunError - #3041

Open
r3wretrhy wants to merge 1 commit into
go-task:mainfrom
r3wretrhy:fix-prompt-cancel-exit-code
Open

r3wretrhy wants to merge 1 commit into
go-task:mainfrom
r3wretrhy:fix-prompt-cancel-exit-code

Conversation

@r3wretrhy

Copy link
Copy Markdown

fix: unwrap inner TaskError code from TaskRunError

TaskCancelledByUserError.Code() is 205 (documented as "Task cancelled by user"), but RunTask wraps every body error in TaskRunError. cmd/task then type-asserts the outer error as TaskError and exits 201.

Keep the wrap (the "Failed to run task" prefix) and return the inner TaskError code when one is present. Command failures with no inner TaskError still exit 201.

go test ./errors/
ok

Fixes #3040

@vmaerten vmaerten self-assigned this Sep 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Prompt cancellation exits 201 instead of documented 205

2 participants