Skip to content

Conversation

@pinebit
Copy link
Collaborator

@pinebit pinebit commented Oct 22, 2025

core package errors revamp with claude.

category: refactor
ticket: #3882

Copy link

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

This PR revamps error messages across the core package to follow a consistent style by removing prefixes like "failed to", "cannot", and "could not" from error messages. The changes maintain the same semantic meaning while providing more concise error descriptions that are better suited for error wrapping contexts.

  • Standardizes error message formatting by removing action prefixes (e.g., "failed to", "cannot")
  • Updates test expectations to match new error message format
  • Improves consistency across error messages throughout the codebase

Reviewed Changes

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

Show a summary per file
File Description
core/validatorapi/validatorapi.go Removes "failed to" and "cannot" prefixes from error messages
core/unsigneddata_test.go Updates test error expectations to match new error message format
core/unsigneddata.go Changes error messages from "cannot be blinded" to "is not blinded"
core/tracker/tracker_internal_test.go Updates test error expectations to remove "could not" prefix
core/tracker/tracker.go Removes "failed at step" from duty error message
core/tracker/inclusion.go Removes "could not" prefix from proposal synthetic determination error
core/sigagg/sigagg.go Changes "verification failed" to "verify" in error wrapper
core/scheduler/scheduler.go Changes "cannot be" to "is" in nil validation error messages
core/qbft/qbft.go Shortens timeout error message for comparison data waiting
core/fetcher/fetcher.go Changes "cannot be nil" to "is nil" for attestation data validation
core/bcast/bcast.go Changes "cannot broadcast" to "convert to blinded proposal" and "cannot be nil" to "is nil"

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@pinebit pinebit requested a review from Copilot October 22, 2025 14:07
Copy link

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

Copilot reviewed 11 out of 11 changed files in this pull request and generated no new comments.


Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@codecov
Copy link

codecov bot commented Oct 22, 2025

Codecov Report

❌ Patch coverage is 13.33333% with 13 lines in your changes missing coverage. Please review.
✅ Project coverage is 53.80%. Comparing base (7479217) to head (52ea213).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
core/scheduler/scheduler.go 0.00% 5 Missing ⚠️
core/validatorapi/validatorapi.go 0.00% 3 Missing ⚠️
core/bcast/bcast.go 0.00% 2 Missing ⚠️
core/fetcher/fetcher.go 0.00% 1 Missing ⚠️
core/qbft/qbft.go 0.00% 1 Missing ⚠️
core/sigagg/sigagg.go 0.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #4046      +/-   ##
==========================================
+ Coverage   53.79%   53.80%   +0.01%     
==========================================
  Files         242      242              
  Lines       39425    39425              
==========================================
+ Hits        21207    21213       +6     
+ Misses      15980    15972       -8     
- Partials     2238     2240       +2     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

defer func() {
if r := recover(); r != nil {
err = errors.New("could not determine if proposal was synthetic or not",
err = errors.New("determine if proposal was synthetic",
Copy link
Collaborator

Choose a reason for hiding this comment

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

I'd keep it as it is. I usually try to follow what we have in the docs, which is to use negative words (cannot/failed/etc.) in new errors and not to use them in wrapping.

Suggested change
err = errors.New("determine if proposal was synthetic",
err = errors.New("could not determine if proposal was synthetic or not",

@pinebit pinebit force-pushed the pinebit/core-errors-revamp branch from d714711 to 3523a67 Compare October 23, 2025 09:50
@sonarqubecloud
Copy link

@pinebit pinebit added the merge when ready Indicates bulldozer bot may merge when all checks pass label Oct 23, 2025
@obol-bulldozer obol-bulldozer bot merged commit 8ad288b into main Oct 23, 2025
12 checks passed
@obol-bulldozer obol-bulldozer bot deleted the pinebit/core-errors-revamp branch October 23, 2025 10:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

merge when ready Indicates bulldozer bot may merge when all checks pass

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants