summaryrefslogtreecommitdiff
path: root/internal/openvpn.go
diff options
context:
space:
mode:
authorjwijenbergh <jeroenwijenbergh@protonmail.com>2022-05-02 14:34:35 +0200
committerjwijenbergh <jeroenwijenbergh@protonmail.com>2022-05-02 14:34:35 +0200
commit466450f0c47bdc614e66326d90e5fc6fb56ae732 (patch)
treea01518a58d50d2f8449d37dadecc40e35c9f1fe1 /internal/openvpn.go
parenta2a8efdcaad3d9b1852b1367a7cd7e8c5860cecf (diff)
Refactor: Wrap most errors in a custom type
Diffstat (limited to 'internal/openvpn.go')
-rw-r--r--internal/openvpn.go12
1 files changed, 11 insertions, 1 deletions
diff --git a/internal/openvpn.go b/internal/openvpn.go
index 1b2e626..ed31fe2 100644
--- a/internal/openvpn.go
+++ b/internal/openvpn.go
@@ -1,12 +1,22 @@
package internal
+import "fmt"
+
func (server *Server) OpenVPNGetConfig() (string, error) {
profile_id := server.Profiles.Current
configOpenVPN, _, configErr := server.APIConnectOpenVPN(profile_id)
if configErr != nil {
- return "", configErr
+ return "", &OpenVPNGetConfigError{Err: configErr}
}
return configOpenVPN, nil
}
+
+type OpenVPNGetConfigError struct {
+ Err error
+}
+
+func (e *OpenVPNGetConfigError) Error() string {
+ return fmt.Sprintf("failed getting OpenVPN config with error: %v", e.Err)
+}