Skip to content

docs: add docs for tasks Result#228

Merged
schaable merged 3 commits intomainfrom
task-result
Mar 2, 2026
Merged

docs: add docs for tasks Result#228
schaable merged 3 commits intomainfrom
task-result

Conversation

@schaable
Copy link
Copy Markdown
Member

@schaable schaable commented Mar 2, 2026

@schaable schaable requested a review from alcuadrado March 2, 2026 16:01
@schaable schaable self-assigned this Mar 2, 2026
Copilot AI review requested due to automatic review settings March 2, 2026 16:01
@vercel
Copy link
Copy Markdown

vercel Bot commented Mar 2, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
hardhat-website Ready Ready Preview, Comment Mar 2, 2026 9:37pm

Request Review

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds documentation for Hardhat task actions returning a Result, and links this concept from the plugin lifecycle docs to the task-writing guide. This supports Hardhat 3 users/plugin authors who want to signal task failure via exit codes without throwing.

Changes:

  • Add a “Returning a result” section to the task actions lifecycle documentation.
  • Add a “Returning a result” section (with a TypeScript example) to the Writing Hardhat tasks guide.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
src/content/docs/docs/plugin-development/explanations/lifecycle.mdx Introduces a short “Returning a result” subsection and links to the tasks guide for details.
src/content/docs/docs/guides/writing-tasks.mdx Adds a new guide section explaining Result, helper functions, and CLI exit code behavior, including an example.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/content/docs/docs/plugin-development/explanations/lifecycle.mdx Outdated
Comment thread src/content/docs/docs/guides/writing-tasks.mdx Outdated
Comment thread src/content/docs/docs/guides/writing-tasks.mdx Outdated
- `{ success: true; value: ValueT }` - a successful result, optionally carrying a value
- `{ success: false; error: ErrorT }` - a failed result, optionally carrying error information

Use `successfulResult(value?)` and `errorResult(error?)` to create these objects. Both success and failure cases can carry data. This is useful when you want to return context regardless of the outcome, such as a test run summary.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here, I wouldn't say that value and error are optional.

Copy link
Copy Markdown
Member

@alcuadrado alcuadrado left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I left a few comments, but looks good

Co-authored-by: Patricio Palladino <patricio@nomic.foundation>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@schaable schaable added this pull request to the merge queue Mar 2, 2026
Merged via the queue into main with commit 2f26efb Mar 2, 2026
3 checks passed
@schaable schaable deleted the task-result branch March 2, 2026 21:41
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.

3 participants