summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorjwijenbergh <jeroenwijenbergh@protonmail.com>2022-02-14 12:36:16 +0100
committerjwijenbergh <jeroenwijenbergh@protonmail.com>2022-04-05 12:26:11 +0200
commit79afcbe57ab0b83c75d44004e6c75c309540448e (patch)
tree6202ec06ee6ff1d81fda9370e67763c432bd5952 /src
parentd306d7b27ee1df60bf32f03b6160856e78d1b02c (diff)
Abstract error handling in python code
Signed-off-by: jwijenbergh <jeroenwijenbergh@protonmail.com>
Diffstat (limited to 'src')
-rw-r--r--src/server.go8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/server.go b/src/server.go
index e39f4c7..7fe3735 100644
--- a/src/server.go
+++ b/src/server.go
@@ -1,9 +1,9 @@
package eduvpn
import (
+ "fmt"
"io/ioutil"
"net/http"
- "fmt"
)
func getFileUrl(url string) ([]byte, error) {
@@ -24,7 +24,7 @@ func getFileUrl(url string) ([]byte, error) {
if readErr != nil {
return nil, detailedVPNError{errRequestFileReadError, fmt.Sprintf("error reading body from file url %s", url), readErr}
}
- return body, nil
+ return body, nil
}
// Helper function that gets a disco json
@@ -64,7 +64,7 @@ func getDiscoFile(jsonFile string) (string, error) {
func GetOrganizationsList() (string, error) {
body, err := getDiscoFile("organization_list.json")
if err != nil {
- return "", err.(detailedRequestError).ToVerifyError()
+ return "", err.(detailedRequestError).ToRequestError()
}
return body, nil
}
@@ -77,6 +77,7 @@ func GetServersList() (string, error) {
// RequestErrorCode Simplified error code for public interface.
type RequestErrorCode = VPNErrorCode
type RequestError = VPNError
+
// detailedRequestErrorCode used for unit tests.
type detailedRequestErrorCode = detailedVPNErrorCode
type detailedRequestError = detailedVPNError
@@ -103,7 +104,6 @@ func (code detailedRequestErrorCode) ToRequestErrorCode() RequestErrorCode {
case errRequestFileReadError:
case errRequestFileHTTPError:
return ErrRequestFileError
- return ErrRequestFileError
case errVerifySigError:
return ErrVerifySigError
}