mirror of
https://github.com/tendermint/tendermint.git
synced 2026-10-01 12:15:45 +00:00
change use of errors.Wrap to fmt.Errorf with %w verb
Closes #4603 Commands used (VIM): ``` :args `rg -l errors.Wrap` :argdo normal @q | update ``` where q is a macros rewriting the `errors.Wrap` to `fmt.Errorf`.
This commit is contained in:
+2
-3
@@ -1,9 +1,8 @@
|
||||
package async
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"sync/atomic"
|
||||
|
||||
"github.com/pkg/errors"
|
||||
)
|
||||
|
||||
//----------------------------------------
|
||||
@@ -144,7 +143,7 @@ func Parallel(tasks ...Task) (trs *TaskResultSet, ok bool) {
|
||||
if pnk := recover(); pnk != nil {
|
||||
atomic.AddInt32(numPanics, 1)
|
||||
// Send panic to taskResultCh.
|
||||
taskResultCh <- TaskResult{nil, errors.Errorf("panic in task %v", pnk)}
|
||||
taskResultCh <- TaskResult{nil, fmt.Errorf("panic in task %v", pnk)}
|
||||
// Closing taskResultCh lets trs.Wait() work.
|
||||
close(taskResultCh)
|
||||
// Decrement waitgroup.
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
package async
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"sync/atomic"
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/pkg/errors"
|
||||
"github.com/stretchr/testify/assert"
|
||||
)
|
||||
|
||||
@@ -125,7 +125,7 @@ func TestParallelRecover(t *testing.T) {
|
||||
// Verify task #0, #1, #2.
|
||||
checkResult(t, taskResultSet, 0, 0, nil, nil)
|
||||
checkResult(t, taskResultSet, 1, 1, errors.New("some error"), nil)
|
||||
checkResult(t, taskResultSet, 2, nil, nil, errors.Errorf("panic in task %v", 2).Error())
|
||||
checkResult(t, taskResultSet, 2, nil, nil, fmt.Errorf("panic in task %v", 2).Error())
|
||||
}
|
||||
|
||||
// Wait for result
|
||||
|
||||
Reference in New Issue
Block a user