chore(all): review error wrappings
- remove repetitive `cannot` and `failed` prefixes - rename `unmarshaling` to `decoding`
This commit is contained in:
@@ -18,19 +18,19 @@ func setupOpenVPN(ctx context.Context, fw Firewall,
|
||||
logger openvpn.Logger) (runner *openvpn.Runner, serverName string, err error) {
|
||||
connection, err := providerConf.GetConnection(settings.Provider.ServerSelection, ipv6Supported)
|
||||
if err != nil {
|
||||
return nil, "", fmt.Errorf("failed finding a valid server connection: %w", err)
|
||||
return nil, "", fmt.Errorf("finding a valid server connection: %w", err)
|
||||
}
|
||||
|
||||
lines := providerConf.OpenVPNConfig(connection, settings.OpenVPN, ipv6Supported)
|
||||
|
||||
if err := openvpnConf.WriteConfig(lines); err != nil {
|
||||
return nil, "", fmt.Errorf("failed writing configuration to file: %w", err)
|
||||
return nil, "", fmt.Errorf("writing configuration to file: %w", err)
|
||||
}
|
||||
|
||||
if *settings.OpenVPN.User != "" {
|
||||
err := openvpnConf.WriteAuthFile(*settings.OpenVPN.User, *settings.OpenVPN.Password)
|
||||
if err != nil {
|
||||
return nil, "", fmt.Errorf("failed writing auth to file: %w", err)
|
||||
return nil, "", fmt.Errorf("writing auth to file: %w", err)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -42,7 +42,7 @@ func setupOpenVPN(ctx context.Context, fw Firewall,
|
||||
}
|
||||
|
||||
if err := fw.SetVPNConnection(ctx, connection, settings.OpenVPN.Interface); err != nil {
|
||||
return nil, "", fmt.Errorf("failed allowing VPN connection through firewall: %w", err)
|
||||
return nil, "", fmt.Errorf("allowing VPN connection through firewall: %w", err)
|
||||
}
|
||||
|
||||
runner = openvpn.NewRunner(settings.OpenVPN, starter, logger)
|
||||
|
||||
Reference in New Issue
Block a user