Skip to content

Commit

Permalink
Make receiver consistent across all methods of ServiceError (#3468)
Browse files Browse the repository at this point in the history
* Make receiver consistent across all methods of ServiceError

* Use `head_ref` for PRs

and `ref` for pushes. `head_ref` refers to the reference of the base branch of the pull request. For non-pull request events, github.head_ref will not be set.
  • Loading branch information
raphael authored Jan 27, 2024
1 parent 3bbb4b2 commit ef763b9
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/report-coverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
uses: actions/checkout@v4
with:
repository: ${{ github.event.workflow_run.head_repository.full_name }}
ref: ${{ github.event_name == 'pull_request' && github.ref || github.head_ref }}
ref: ${{ github.event_name == 'pull_request' && github.head_ref || github.ref }}

- name: Download test coverage
uses: dawidd6/action-download-artifact@v3
Expand Down
6 changes: 3 additions & 3 deletions pkg/error.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ type (
Fault bool
// History tracks all the individual errors that were built into this error, should
// this error have been merged.
history []ServiceError
history []*ServiceError
// err holds the original error if exists.
err error
}
Expand Down Expand Up @@ -238,12 +238,12 @@ func MergeErrors(err, other error) error {
}

// History returns the history of error revisions, ignoring the result of any merges.
func (e ServiceError) History() []ServiceError {
func (e *ServiceError) History() []*ServiceError {
if len(e.history) > 0 {
return e.history
}

return []ServiceError{e}
return []*ServiceError{e}
}

// Error returns the error message.
Expand Down

0 comments on commit ef763b9

Please sign in to comment.