Skip to content

Commit 26f8e33

Browse files
committed
fix: use %w for errors
Signed-off-by: Chris Gianelloni <wolf31o2@blinklabs.io>
1 parent 64d59b9 commit 26f8e33

File tree

3 files changed

+8
-8
lines changed

3 files changed

+8
-8
lines changed

internal/config/config.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -109,19 +109,19 @@ func Load(configFile string) (*Config, error) {
109109
if configFile != "" {
110110
buf, err := os.ReadFile(configFile)
111111
if err != nil {
112-
return nil, fmt.Errorf("error reading config file: %s", err)
112+
return nil, fmt.Errorf("error reading config file: %w", err)
113113
}
114114
err = yaml.Unmarshal(buf, globalConfig)
115115
if err != nil {
116-
return nil, fmt.Errorf("error parsing config file: %s", err)
116+
return nil, fmt.Errorf("error parsing config file: %w", err)
117117
}
118118
}
119119
// Load config values from environment variables
120120
// We use "dummy" as the app name here to (mostly) prevent picking up env
121121
// vars that we hadn't explicitly specified in annotations above
122122
err := envconfig.Process("dummy", globalConfig)
123123
if err != nil {
124-
return nil, fmt.Errorf("error processing environment: %s", err)
124+
return nil, fmt.Errorf("error processing environment: %w", err)
125125
}
126126
// Populate network magic value from network name
127127
if globalConfig.Node.Network != "" {

internal/node/node.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -46,14 +46,14 @@ func GetConnection(connCfg *ConnectionConfig) (*ouroboros.Connection, error) {
4646
ouroboros.WithLocalTxSubmissionConfig(buildLocalTxSubmissionConfig()),
4747
)
4848
if err != nil {
49-
return nil, fmt.Errorf("failure creating Ouroboros connection: %s", err)
49+
return nil, fmt.Errorf("failure creating Ouroboros connection: %w", err)
5050
}
5151

5252
if cfg.Node.Address != "" && cfg.Node.Port > 0 {
5353
// Connect to TCP port
5454
if err := oConn.Dial("tcp", fmt.Sprintf("%s:%d", cfg.Node.Address, cfg.Node.Port)); err != nil {
5555
return nil, fmt.Errorf(
56-
"failure connecting to node via TCP: %s",
56+
"failure connecting to node via TCP: %w",
5757
err,
5858
)
5959
}
@@ -63,11 +63,11 @@ func GetConnection(connCfg *ConnectionConfig) (*ouroboros.Connection, error) {
6363
if os.IsNotExist(err) {
6464
return nil, fmt.Errorf("node socket path does not exist: %s", cfg.Node.SocketPath)
6565
} else {
66-
return nil, fmt.Errorf("unknown error checking if node socket path exists: %s", err)
66+
return nil, fmt.Errorf("unknown error checking if node socket path exists: %w", err)
6767
}
6868
}
6969
if err := oConn.Dial("unix", cfg.Node.SocketPath); err != nil {
70-
return nil, fmt.Errorf("failure connecting to node via UNIX socket: %s", err)
70+
return nil, fmt.Errorf("failure connecting to node via UNIX socket: %w", err)
7171
}
7272
} else {
7373
return nil, errors.New("you must specify either the UNIX socket path or the address/port for your cardano-node")

internal/utxorpc/sync.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,7 @@ func (s *chainSyncServiceServer) FollowTip(
197197
} else {
198198
tip, err := oConn.ChainSync().Client.GetCurrentTip()
199199
if err != nil {
200-
return fmt.Errorf("failed to get tip: %s", err)
200+
return fmt.Errorf("failed to get tip: %w", err)
201201
}
202202
if tip != nil {
203203
point = tip.Point

0 commit comments

Comments
 (0)